1
0
mirror of https://github.com/rudollee/LearningMVC.git synced 2025-06-08 00:16:14 +00:00
2017-04-08 03:51:50 +09:00

18 lines
696 B
Plaintext

@model IEnumerable<string>
@{
bool horizontal = ((bool)(ViewContext.RouteData.Values["horizontalLayout"] ?? false));
string wrapperClasses = horizontal ? "btn-group btn-group-sm btn-group-justified" : null;
}
<div class="@wrapperClasses">
@Html.ActionLink("Home", "List", "Product", null, new { @class = horizontal ? "btn btn-default btn-sm" : "btn btn-block btn-default btn-lg" })
@foreach (var link in Model)
{
@Html.RouteLink(link,
new { controller = "Product", action = "List", category = link, page = 1 },
new { @class = (horizontal ? "btn btn-default btn-sm" : "btn btn-block btn-default btn-lg") + (link == ViewBag.SelectedCategory ? " btn-primary" : "") })
}
</div>