1
0
mirror of https://github.com/rudollee/LearningMVC.git synced 2025-06-08 00:16:14 +00:00
wook 5fff10e2a0 Ch. 8
SportsStore 2nd
2017-04-07 01:45:20 +09:00

35 lines
719 B
C#

using System;
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
{
private IProductRepository repository;
public NavController(IProductRepository repo)
{
repository = repo;
}
public PartialViewResult Menu(string category = null)
{
ViewBag.SelectedCategory = category;
IEnumerable<string> categories = repository.Products
.Select(x => x.Category)
.Distinct()
.OrderBy(x => x);
return PartialView(categories);
}
//public string Menu()
//{
// return "Hello from NavController";
//}
}
}