Esempio n. 1
0
        public static (PagedListProperties, IQueryable <T>) Paginate(IQueryable <T> source, int pageNumber, int pageSize)
        {
            var count = source.Count();
            var items = source.Skip((pageNumber - 1) * pageSize).Take(pageSize);

            var properties = new PagedListProperties
            {
                Count      = count,
                PageNumber = pageNumber,
                PageSize   = pageSize
            };

            return(properties, items);
        }
Esempio n. 2
0
 public static PagedList <T> Create(PagedListProperties properties, IEnumerable <T> items)
 {
     return(new(items, properties.Count, properties.PageNumber, properties.PageSize));
 }