public async Task OnGetAsync() { SportokPagedList = mapper.Map <List <SportViewModel> >(await sportService.GetPaginatedSportListAsync(CurrentPage, PagerConstants.PageSize)); SportokPagedList = SportHelper.SetSelectedSportsTrue(SportokPagedList, SelectedIds); Pagination.Count = await sportService.GetCountAsync(); Pagination.TotalPages = (int)Math.Ceiling(decimal.Divide(Pagination.Count, PagerConstants.PageSize)); }
public async Task OnGetAsync() { if (SelectedIds == null) { SelectedIds = mapper.Map <List <int> >(await sportService.GetSportIdListToUserAsync((await userManager.FindByNameAsync(User.Identity.Name)).Id)); } SportokPagedList = mapper.Map <List <SportViewModel> >(await sportService.GetPaginatedSportListAsync(CurrentPage, PagerConstants.PageSize)); SportokPagedList = SportHelper.SetSelectedSportsTrue(SportokPagedList, SelectedIds); Pagination.Count = await sportService.GetCountAsync(); Pagination.TotalPages = (int)Math.Ceiling(decimal.Divide(Pagination.Count, PagerConstants.PageSize)); }