コード例 #1
0
        public ActionResult IndexPOST(IList <MenuItemEntry> menuItemEntries)
        {
            if (!_services.Authorizer.Authorize(Permissions.ManageMainMenu, T("Couldn't manage the main menu")))
            {
                return(new HttpUnauthorizedResult());
            }

            // See http://orchard.codeplex.com/workitem/17116
            if (menuItemEntries != null)
            {
                foreach (var menuItemEntry in menuItemEntries)
                {
                    MenuPart menuPart = _menuService.Get(menuItemEntry.MenuItemId);

                    menuPart.MenuText     = menuItemEntry.Text;
                    menuPart.MenuPosition = menuItemEntry.Position;
                    if (menuPart.Is <MenuItemPart>())
                    {
                        menuPart.As <MenuItemPart>().Url = menuItemEntry.Url;
                    }
                }
            }

            return(RedirectToAction("Index"));
        }
コード例 #2
0
 private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart)
 {
     return(new MenuItemEntry {
         MenuItemId = menuPart.Id,
         IsMenuItem = menuPart.Is <MenuItemPart>(),
         Text = menuPart.MenuText,
         Position = menuPart.MenuPosition,
         Url = menuPart.Is <MenuItemPart>()
                       ? menuPart.As <MenuItemPart>().Url
                       : _navigationManager.GetUrl(null, _services.ContentManager.GetItemMetadata(menuPart).DisplayRouteValues),
     });
 }
コード例 #3
0
 private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart) {
     return new MenuItemEntry {
         MenuItemId = menuPart.Id,
         IsMenuItem = menuPart.Is<MenuItemPart>(),
         Text = menuPart.MenuText,
         Position = menuPart.MenuPosition,
         Url = menuPart.Is<MenuItemPart>()
             ? menuPart.As<MenuItemPart>().Url
             : _navigationManager.GetUrl(null, Services.ContentManager.GetItemMetadata(menuPart).DisplayRouteValues),
         ContentItem = menuPart.ContentItem,
     };
 }