diff --git a/SportsStore/SportsStore.WebUI/Controllers/NavController.cs b/SportsStore/SportsStore.WebUI/Controllers/NavController.cs index 99019bc..5c046bd 100644 --- a/SportsStore/SportsStore.WebUI/Controllers/NavController.cs +++ b/SportsStore/SportsStore.WebUI/Controllers/NavController.cs @@ -3,14 +3,27 @@ using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; +using SportsStore.Domain.Abstract; namespace SportsStore.WebUI.Controllers { public class NavController : Controller { - public string Menu() + private IProductRepository repository; + + public NavController(IProductRepository repo) { - return "Hello from NavController"; + repository = repo; + } + + public PartialViewResult Menu() + { + IEnumerable categories = repository.Products + .Select(x => x.Category) + .Distinct() + .OrderBy(x => x); + + return PartialView(categories); } } } \ No newline at end of file