Ejemplo n.º 1
0
        public static IList <T> ToOrderedPagination <T>(this IOrderedQueryable <T> queryable, PaginationOptions options, out int totalCount)
        {
            var pageNumber        = Math.Max(DefaultPageNumber, Convert.ToInt32(options.Page));
            var pageSize          = Math.Max(DefaultPageSize, Convert.ToInt32(options.PageSize));
            var orderedPagination = new OrderedPagination <T>(queryable, pageNumber, pageSize);

            totalCount = orderedPagination.TotalItems;
            return(orderedPagination.GetPaginatedList());
        }
Ejemplo n.º 2
0
        public static IList <T> ToOrderedPagination <T>(this IQueryable <T> queryable, PaginationOptions options, out int totalCount)
        {
            var orderProperty     = options.Order == null ? new Dictionary <string, string>() : options.Order.ParseForOrder <T>();
            var pageNumber        = Math.Max(DefaultPageNumber, Convert.ToInt32(options.Page));
            var pageSize          = Math.Max(DefaultPageSize, Convert.ToInt32(options.PageSize));
            var orderedPagination = new OrderedPagination <T>(queryable, pageNumber, pageSize, orderProperty);

            totalCount = orderedPagination.TotalItems;
            return(orderedPagination.GetOrderedPaginatedList());
        }