/// <summary> /// Creates a new paging options based on a nullable page and page size. /// </summary> /// <param name="page">Either null, or a 1 based page number (not page index)</param> /// <param name="itemsPerPage">Either null for the default, or the number of items for each page.</param> /// <returns></returns> public static PagingOptions GetPagingByPage(int?page, int?itemsPerPage) { if (!page.HasValue && !itemsPerPage.HasValue) { return(PagingOptions.GetDisabledPagingOptions()); } if (!itemsPerPage.HasValue) { return new PagingOptions() { PageIndex = page.Value - 1 } } ; if (!page.HasValue) { return new PagingOptions() { PageIndex = 0, PageSize = itemsPerPage.Value } } ; return(new PagingOptions() { PageIndex = page.Value - 1, PageSize = itemsPerPage.Value }); } #endregion Specialty } }
/// <summary> /// Gets a set of PagingOptions with paging disabled. /// </summary> /// <returns></returns> public static PagingAndSortOptions GetDisabledPagingAndSortOptions() { return(new PagingAndSortOptions(PagingOptions.GetDisabledPagingOptions())); }