public async virtual Task <IEnumerable <TModel> > FindAllAsync(PagingDetail pagingDetail) { if (pagingDetail.PageSize <= 0 || pagingDetail.PageNumber < 0) { return(new List <TModel>()); } var results = dbContext.Set <TModel>().Skip((pagingDetail.PageNumber * pagingDetail.PageSize) - pagingDetail.PageSize); results = results.Take(pagingDetail.PageSize); return(await results.ToListAsync()); }
public virtual IEnumerable <TModel> FindAll(PagingDetail pagingDetail) { if (pagingDetail.PageSize <= 0 || pagingDetail.PageNumber < 0) { return(new List <TModel>()); } var results = dbContext.Set <TModel>().Skip((pagingDetail.PageNumber * pagingDetail.PageSize) - pagingDetail.PageSize); results = results.Take(pagingDetail.PageSize); return(results.ToList()); }