Esempio n. 1
0
 public IActionResult Edit(Recipe recipe, Reviews reviews, Ingredients ingredients)
 {
     if (ModelState.IsValid)
     {
         repository.SaveRecipe(recipe, reviews, ingredients);
         TempData["message"] = $"{recipe.Name} has been saved";
         return(RedirectToAction("Index"));
     }
     else
     {
         // there is something wrong with the data values
         return(View(recipe));
     }
 }
 public ActionResult <Recipe> Put(int id, [FromBody] Recipe recipe)
 {
     return(new JsonResult(_recipeRepo.SaveRecipe(id, recipe)));
 }