Esempio n. 1
0
        public painatedList(IQueryable <T> source, PaginationBase paginationBase)
        {
            PaginationBase = paginationBase;
            int total = source.Count();

            this.Count      = total;
            this.TotalPages = (int)Math.Ceiling(total / (double)paginationBase.PageSize);
            this.PageSize   = paginationBase.PageSize;
            this.PageIndex  = paginationBase.PageIndex;
            this.AddRange(source.Skip(Math.Max(paginationBase.PageIndex - 1, 0) * paginationBase.PageSize).Take(paginationBase.PageSize).ToList());
        }
Esempio n. 2
0
 public static IPagedList <T> ToPageList <T>(this IQueryable <T> source, PaginationBase paginationBase) => new painatedList <T>(source, paginationBase);