diff --git a/SportsStore/SportsStore.WebUI/Controllers/ProductController.cs b/SportsStore/SportsStore.WebUI/Controllers/ProductController.cs index cd85301..9b7e8fe 100644 --- a/SportsStore/SportsStore.WebUI/Controllers/ProductController.cs +++ b/SportsStore/SportsStore.WebUI/Controllers/ProductController.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Web; using System.Web.Mvc; using SportsStore.Domain.Abstract; +using SportsStore.WebUI.Models; namespace SportsStore.WebUI.Controllers { @@ -19,10 +20,20 @@ namespace SportsStore.WebUI.Controllers public ViewResult List(int page = 1) { - return View(repository.Products - .OrderBy(p => p.ProductID) - .Skip((page - 1) * PageSize) - .Take(PageSize)); + ProductsListViewModel model = new ProductsListViewModel + { + Products = repository.Products + .OrderBy(p => p.ProductID) + .Skip((page - 1) * PageSize) + .Take(PageSize), + PagingInfo = new PagingInfo + { + CurrentPage = page, + ItemsPerPage = PageSize, + TotalItems = repository.Products.Count() + } + }; + return View(model); } } } \ No newline at end of file