10.2.2.1 Helping the Controller Select a View; Listing 10-5 Updating the Menu Action Method in the NavController.cs File
parent
b03c3d3e77
commit
fe196ca256
|
@ -16,7 +16,8 @@ namespace SportsStore.WebUI.Controllers
|
||||||
repository = repo;
|
repository = repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartialViewResult Menu(string category = null)
|
public PartialViewResult Menu(string category = null,
|
||||||
|
bool horizontalLayout = false)
|
||||||
{
|
{
|
||||||
ViewBag.SelectedCategory = category;
|
ViewBag.SelectedCategory = category;
|
||||||
|
|
||||||
|
@ -25,7 +26,8 @@ namespace SportsStore.WebUI.Controllers
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.OrderBy(x => x);
|
.OrderBy(x => x);
|
||||||
|
|
||||||
return PartialView(categories);
|
string viewName = horizontalLayout ? "MenuHorizontal" : "Menu";
|
||||||
|
return PartialView(viewName, categories);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue