public PagedResult <T> List <T>(Expression <Func <T, Object> > predicateSort, EnumOrder typeOrder, int page, int limit) where T : BaseEntity { IQueryable <T> result = _dbContext.Set <T>(); result = GetOrderResult(result, predicateSort, typeOrder.ToString()); IQueryable <T> pagedResult = null; int totalPages = 0; GetPagedResult(result, page, limit, out pagedResult, out totalPages); return(new PagedResult <T> { Result = pagedResult, TotalPages = totalPages }); }
public PagedResult <T> Filter <T>(Expression <Func <T, bool> > predicate, string[] navProperties, Expression <Func <T, Object> > predicateSort, EnumOrder typeOrder, int page, int limit) where T : BaseEntity { if (predicate == null) { return(null); } IQueryable <T> result = _dbContext.Set <T>().Where(predicate); result = SetIncludes(result, navProperties); result = GetOrderResult(result, predicateSort, typeOrder.ToString()); IQueryable <T> pagedResult = null; int totalPages = 0; GetPagedResult(result, page, limit, out pagedResult, out totalPages); return(new PagedResult <T> { Result = pagedResult, TotalPages = totalPages }); }