@using Seyoit.Website.Config
@using Seyoit.Website.Config.Navigation
@{
var action = ViewContext.RouteData.Values["action"].ToString().ToLower();
var ctrl = ViewContext.RouteData.Values["controller"].ToString().ToLower();
string id = string.Empty;
if (ViewContext.RouteData.Values.ContainsKey("id"))
{
id = ViewContext.RouteData.Values["id"].ToString().ToLower();
}
var navList = Container.Navigation.NavigationGroups["menu"].NavigationList;
NavigationModel nav = null;
if (action.Equals("index") && ctrl.Equals("home"))
{
nav = Container.Navigation.Navigations["index"];
}
else
{
foreach (var item in navList)
{
if (item.Controller.ToLower().Equals(ctrl) && item.Action.ToLower().Equals(action) && item.Parameter.Equals(id))
{
nav = item;
break;
}
}
}
}
@if (nav != null && nav.NavigationList != null)
{
int i = 0;
<ul>
@foreach (var item in nav.NavigationList)
{
if (i < 1)
{
<li>@Html.ActionLink(item.Text, item.Action, item.Controller, new { id = item.Parameter }, new { })</li>
}
else
{
<li class="borderWhite">@Html.ActionLink(item.Text, item.Action, item.Controller, new { id = item.Parameter }, new { })</li>
}
i++;
}
</ul>
}