This commit is contained in:
mmrbnjd
2025-01-23 02:44:11 +03:30
parent e40192c428
commit 505adf6ab2
12 changed files with 168 additions and 92 deletions

View File

@@ -95,6 +95,21 @@ namespace Back.Common
return new PagingDto<T>(rowCount, PageCount, await values.Skip(skip).Take(take).ToListAsync());
}
}
public static async Task<PagingDto<T>> Paging<T>(this IEnumerable<T> values, int pageId, int take)
{
if (/*values.Count()<1000 && */pageId == 0 && take == 0)
{
return new PagingDto<T>(values.Count(), 1, values.ToList());
}
else
{
int skip = (pageId - 1) * take;
int rowCount = values.Count();
int PageCount = rowCount % take == 0 ? rowCount / take : rowCount / take + 1;
return new PagingDto<T>(rowCount, PageCount, values.Skip(skip).Take(take).ToList());
}
}
public static System.Linq.Expressions.Expression<Func<TEntity, bool>> GetFunc<TEntity>(string Fild, string Value)
{