public async Task <IActionResult> Index(int?page) { int pageSize = _paginationConfiguration.PageSize; int width = _paginationConfiguration.Width; int count = await _reserveRepository.GetCount(); int currentPage = page ?? 1; DataResult <List <ReserveModel> > result = await _reserveService.GetPartOfReserves((currentPage - 1) *pageSize, pageSize); if (result.Success) { return(View(new GenericPaginatedModel <ReserveModel> { Models = result.Data, Pagination = new PaginationModel( count, currentPage, pageSize, "Index" ), })); } return(RedirectToAction("Error", "Error", new { result.ErrorCode, modelName = nameof(Reserve) })); }