Created
October 2, 2018 21:00
-
-
Save mikebrind/a323d4e34a23357e96da2a9c15ba7c56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PaginationModel : PageModel | |
{ | |
private readonly IPersonService _personService; | |
public PaginationModel(IPersonService personService) | |
{ | |
_personService = personService; | |
} | |
[BindProperty(SupportsGet = true)] | |
public int CurrentPage { get; set; } = 1; | |
public int Count { get; set; } | |
public int PageSize { get; set; } = 10; | |
public int TotalPages => (int)Math.Ceiling(decimal.Divide(Count, PageSize)); | |
public List<Models.Person> Data { get; set; } | |
public bool ShowPrevious => CurrentPage > 1; | |
public bool ShowNext => CurrentPage < TotalPages; | |
public bool ShowFirst => CurrentPage != 1; | |
public bool ShowLast => CurrentPage != TotalPages; | |
public async Task OnGetAsync() | |
{ | |
Data = await _personService.GetPaginatedResult(CurrentPage, PageSize); | |
Count = await _personService.GetCount(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I am not find css. Paging is implemented