feat: 增加 Long 转型扩展

This commit is contained in:
Argo-Tianyi 2022-01-02 17:08:58 +08:00
parent c83725bfa1
commit 93630f99b4
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,19 @@
namespace BootstrapAdmin.DataAccess.PetaPoco.Extensions;
/// <summary>
///
/// </summary>
public static class LongExtensions
{
/// <summary>
///
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static int ToInt32(this long source)
{
int ret;
_ = int.TryParse(source.ToString(), out ret);
return ret;
}
}

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
using BootstrapAdmin.DataAccess.PetaPoco.Extensions;
using BootstrapAdmin.Web.Extensions;
using BootstrapBlazor.Components;
using PetaPoco;
@ -71,7 +72,7 @@ class DefaultDataService<TModel> : DataServiceBase<TModel> where TModel : class,
{
var items = await Database.PageAsync<TModel>(option);
ret.TotalCount = Convert.ToInt32(items.TotalItems);
ret.TotalCount = items.TotalItems.ToInt32();
ret.Items = items.Items;
}
else