public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         var newMenuItem = MenuItem.ToDomainModel();
         _menuItemService.Create(newMenuItem);
         return(RedirectToPage("/Confirmation", "NewItemCreated"));
     }
     return(Page());
 }
Beispiel #2
0
 public IActionResult Create(MenuItem menuItem)
 {
     if (ModelState.IsValid)
     {
         _menuItemService.Create(menuItem);
         _menuItemService.Commit();
         return(RedirectToAction("Index"));
     }
     ViewBag.Menu = new SelectList(_menuService.GetAll(), "Id", "Name", menuItem.MenuId);
     return(View(menuItem));
 }
Beispiel #3
0
        public ActionResult Create(CreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.MenuList = _menuService.Get();

                return(View("_Create", model));
            }

            _menuItemService.Create(model.MenuId, model.LinkText, model.LinkAction, model.LinkController, model.LinkArea);

            return(this.Content("Refresh"));
        }
Beispiel #4
0
        public ActionResult Create(CreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.MenuList = _menuService.Get();
                model.PageList = _pageService.Get();
                model.PostList = _postService.Get(string.Empty, true);
                model.RoleList = _roleService.Get();

                return(View("_Create", model));
            }

            var menuItemId = _menuItemService.Create(model.MenuId, model.LinkText, model.LinkURL, model.LinkIcon);

            _menuItemService.Roles(menuItemId, model.SelectedRoleList);

            return(this.Content("Refresh"));
        }