Beispiel #1
0
        public ActionResult CreateMenuItem(MenuItemViewModel menuItemViewModel)
        {
            try {
                if (ModelState.IsValid)
                {
                    var menuItem = new MenuItemModel {
                        MenuID        = menuItemViewModel.MenuID,
                        Url           = menuItemViewModel.Url,
                        PageID        = menuItemViewModel.PageID,
                        TitleMenuItem = menuItemViewModel.TitleMenuItem,
                        Weight        = menuItemViewModel.Weight
                    };

                    _menuItemManager.SaveMenu(menuItem);

                    return(RedirectToAction("ManagementMenu"));
                }
            }
            catch (ValidationException ex) {
                ModelState.AddModelError(ex.Property, ex.Message);
            }
            ViewBag.Pages = GetPublishedPages();

            return(View(menuItemViewModel));
        }