Exemple #1
0
        public async Task <IActionResult> Create([Bind("Name", "Text")] MenuItemsModel menuItemsModel)
        {
            if (ModelState.IsValid)
            {
                await _menuItemsService.Create(menuItemsModel);

                return(RedirectToAction(nameof(AdminIndex)));
            }
            return(View(menuItemsModel));
        }
Exemple #2
0
 public IActionResult OnPost(MenuItemView menuItem)
 {
     if (ModelState.IsValid)
     {
         var domainModel = menuItem.ToModel();
         var response    = _menuItemsService.Create(domainModel);
         if (!response.IsSuccessfull)
         {
             ErrorMessage = response.Message;
             return(Page());
         }
     }
     return(RedirectToPage("/Admin/MenuItemsList"));
 }