Exemple #1
0
 public PaginatedList(List <T> items, int count, PagingCriteria criteria)
 {
     PageIndex  = criteria.PageIndex;
     TotalPages = (int)Math.Ceiling(count / (double)criteria.PageSize);
     TotalCount = count;
     this.AddRange(items);
 }
Exemple #2
0
        public static async Task <PaginatedList <T> > Create(IQueryable <T> source, PagingCriteria criteria)
        {
            var count = await source.CountAsync();

            var items = await source.Skip((criteria.PageIndex - 1) *criteria.PageSize).Take(criteria.PageSize).ToListAsync();

            return(new PaginatedList <T>(items, count, criteria));
        }