Example #1
0
 public IActionResult CreateIngredient(CreateEditIngredientModel model)
 {
     if (ModelState.IsValid)
     {
         IngredientDTO ingredient = new IngredientDTO
         {
             Name  = model.Name,
             Price = model.Price
         };
         var result = _adminManager.CreateIngredient(ingredient);
         if (result.Succedeed)
         {
             return(RedirectToAction("Ingredients"));
         }
         else
         {
             ModelState.AddModelError(result.Property, result.Message);
         }
     }
     return(View(model));
 }