public static PaginationSummary GetSummaryPagination(this HtmlHelper htmlHelper, int pageIndex, int totalCount, int pageSize)
 {
     var pageCount = (int)Math.Ceiling((double)totalCount / pageSize);
     var summary = new PaginationSummary(
         pageCount,
         pageIndex,
         totalCount,
         pageSize,
         new PaginationSummaryItem(pageIndex > 1, pageIndex > 1 ? 1 : (int?)null),
         new PaginationSummaryItem(pageIndex > 1, pageIndex > 1 ? pageIndex - 1 : (int?)null),
         new PaginationSummaryItem(pageIndex + 1 <= pageCount, pageIndex + 1 <= pageCount ? pageIndex + 1 : (int?)null),
         new PaginationSummaryItem(pageIndex < pageCount, pageIndex < pageCount ? pageCount : (int?)null));
     return summary;
 }
Ejemplo n.º 2
0
        public static PaginationSummary GetSummaryPagination(this HtmlHelper htmlHelper, int pageIndex, int totalCount, int pageSize)
        {
            var pageCount = (int)Math.Ceiling((double)totalCount / pageSize);
            var summary   = new PaginationSummary(
                pageCount,
                pageIndex,
                totalCount,
                pageSize,
                new PaginationSummaryItem(pageIndex > 1, pageIndex > 1 ? 1 : (int?)null),
                new PaginationSummaryItem(pageIndex > 1, pageIndex > 1 ? pageIndex - 1 : (int?)null),
                new PaginationSummaryItem(pageIndex + 1 <= pageCount, pageIndex + 1 <= pageCount ? pageIndex + 1 : (int?)null),
                new PaginationSummaryItem(pageIndex < pageCount, pageIndex < pageCount ? pageCount : (int?)null));

            return(summary);
        }