Skip to content

Commit ce0e36b

Browse files
committed
Fix wrong calculation of items per page in catalog controller (last page was showing always 10)
1 parent e5c0340 commit ce0e36b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Web/WebMonolithic/eShopWeb/Controllers/CatalogController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public CatalogController(IHostingEnvironment env, ICatalogService catalogSvc)
2626
public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page)
2727
{
2828
var itemsPage = 10;
29-
var catalog = await _catalogSvc.GetCatalogItems(page ?? 0, itemsPage, BrandFilterApplied, TypesFilterApplied);
29+
var catalog = await _catalogSvc.GetCatalogItems(page ?? 0, itemsPage, BrandFilterApplied, TypesFilterApplied);
3030

3131
var vm = new CatalogIndex()
3232
{
@@ -38,7 +38,7 @@ public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilter
3838
PaginationInfo = new PaginationInfo()
3939
{
4040
ActualPage = page ?? 0,
41-
ItemsPerPage = (catalog.Count < itemsPage) ? catalog.Count : itemsPage,
41+
ItemsPerPage = catalog.Data.Count,
4242
TotalItems = catalog.Count,
4343
TotalPages = int.Parse(Math.Ceiling(((decimal)catalog.Count / itemsPage)).ToString())
4444
}

0 commit comments

Comments
 (0)