8.1.4 Correcting the Page Count; Listing 8-11 Creating the Category-Aware Pagination Data in the ProductController.cs File
parent
59e5f471db
commit
8f39a1ae1c
|
@ -32,7 +32,9 @@ namespace SportsStore.WebUI.Controllers
|
||||||
{
|
{
|
||||||
CurrentPage = page,
|
CurrentPage = page,
|
||||||
ItemsPerPage = PageSize,
|
ItemsPerPage = PageSize,
|
||||||
TotalItems = repository.Products.Count()
|
TotalItems = category == null ?
|
||||||
|
repository.Products.Count() :
|
||||||
|
repository.Products.Where(e => e.Category == category).Count()
|
||||||
},
|
},
|
||||||
CurrentCategory = category
|
CurrentCategory = category
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue