protected void ResolveMenu(ActionExecutingContext filterContext, string menuId, string viewdataName) { if (String.IsNullOrEmpty(menuId)) { return; } var menu = Menus[menuId]; var key = MenuKey + menuId; var menuViewModel = Session[key] as MenuViewModel; if (null == menuViewModel || menuViewModel.Revision != menu.Document.Revision) { var allowed = MenusRepository.GetResourcesForUser(CurrentUser); menuViewModel = new MenuViewModel( menu.Items.Where(x => MenuViewModelItem.IsVisible(x, allowed)) .Select(x => MenuViewModelItem.FromDomain(x, Url, allowed)) ); menuViewModel.Revision = menu.Document.Revision; Session[key] = menuViewModel; } ViewData[viewdataName] = menuViewModel; }
public virtual ActionResult Index() { ViewData["awards"] = MenusRepository.GetResourcesForUser(CurrentUser).Where(x => x.Type == MenuItemType.Award).Select(x => Awards[x.Id]).ToList(); return(Request.IsAjaxRequest() ? (ActionResult)PartialView("Index") : View("Index")); }