Sakura.AspNetCore.Extensions/Sakura.AspNetCore.Mvc.PagedList/Internal/DefaultPagerListGenerator.cs
/// <summary>
///     Generate a pager item for a special layout element.
/// </summary>
/// <param name="currentPage">The current page number.</param>
/// <param name="totalPage">The count of total pages.</param>
/// <param name="element">The <see cref="PagerLayoutElement" /> to generate the <see cref="PagerItem" />.</param>
/// <returns>The generated <see cref="PagerItem" /> for the <paramref name="element" />.</returns>
/// <exception cref="ArgumentException">
///     The <paramref name="element" /> is <see cref="PagerLayoutElement.Items" />, or it is not
///     a valid enum item.
/// </exception>
Generate a pager item for a special layout element.
Generate a pager item for a special layout element .
private PagerItem GenerateSpecialItems(int currentPage, int totalPage, PagerLayoutElement element)
		{
			PagerItemType type;
			int pageNumber;
			switch (element)
			{
				case PagerLayoutElement.GoToFirstPageButton:
					type = PagerItemType.First;
					pageNumber = 1;
					break;
				case PagerLayoutElement.GoToLastPageButton:
					type = PagerItemType.Last;
					pageNumber = totalPage;
					break;
				case PagerLayoutElement.GoToPreviousPageButton:
					type = PagerItemType.Previous;
					pageNumber = currentPage - 1;
					break;
				case PagerLayoutElement.GoToNextPageButton:
					type = PagerItemType.Next;
					pageNumber = currentPage + 1;
					break;
				case PagerLayoutElement.Items:
					throw new ArgumentException("This method is invalid for normal item layout.", nameof(element));
				default:
					throw new ArgumentException("The argument is not a valid enum item.", nameof(element));
			}
			return new PagerItem
			{
				ItemType = type,
				PageNumber = pageNumber
			};
		}
private PagerItem GenerateSpecialItems ( int currentPage , int totalPage , PagerLayoutElement element ) { PagerItemType type ; int pageNumber ; switch ( element ) { case PagerLayoutElement . GoToFirstPageButton : type = PagerItemType . First ; pageNumber = 1 ; break ; case PagerLayoutElement . GoToLastPageButton : type = PagerItemType . Last ; pageNumber = totalPage ; break ; case PagerLayoutElement . GoToPreviousPageButton : type = PagerItemType . Previous ; pageNumber = currentPage - 1 ; break ; case PagerLayoutElement . GoToNextPageButton : type = PagerItemType . Next ; pageNumber = currentPage + 1 ; break ; case PagerLayoutElement . Items : throw new ArgumentException ( " " , nameof ( element ) ) ; default : throw new ArgumentException ( " " , nameof ( element ) ) ; } return new PagerItem { ItemType = type , PageNumber = pageNumber } ; }
Generate a pager item for a special layout element.
Generate a pager item for a special layout element .
The generated  for the .
The generated for the .
The  is , or it is not
a valid enum item.
The is or it is not a valid enum item .
currentPage
int
The current page number.
The current page number .
totalPage
int
The count of total pages.
The count of total pages .
element
PagerLayoutElement
The  to generate the .
The to generate the .