Candor.PagingOptions.GetPagingByPage C# (CSharp) Méthode

GetPagingByPage() public static méthode

Creates a new paging options based on a nullable page and page size.
public static GetPagingByPage ( int page, int itemsPerPage ) : PagingOptions
page int Either null, or a 1 based page number (not page index)
itemsPerPage int Either null for the default, or the number of items for each page.
Résultat PagingOptions
        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 };
        }