Exemple #1
0
        public IActionResult Create(Guid?parentId)
        {
            ViewBag.Domain = _configuration["Domain"];
            var newModel = new MenuItemNewModel
            {
                ParentId = parentId ?? Guid.Empty
            };

            return(View(newModel));
        }
Exemple #2
0
        public async Task <IActionResult> Create(MenuItemNewModel item)
        {
            ViewBag.Domain = _configuration["Domain"];
            if (ModelState.IsValid)
            {
                Guid id = await _menuItemFacade.Create(item);

                return(item.ParentId != Guid.Empty ?
                       RedirectToAction(nameof(Details), new { id = item.ParentId, area = "Admin" }) :
                       RedirectToAction(nameof(Index), new { area = "Admin" }));
            }
            return(View(item));
        }