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