Esempio n. 1
0
 public ActionResult Edit(Recipe recipe)
 {
     if (ModelState.IsValid)
     {
         RecipeRepository.Edit(recipe);
         return(RedirectToAction("Index"));
     }
     return(View(recipe));
 }
Esempio n. 2
0
        public IActionResult ModifyConfirmation(IFormCollection formCollection)
        {
            if (String.IsNullOrEmpty(formCollection["recipename"]))
            {
                return(View("Error"));
            }

            var recipe = new Recipe()
            {
                Name = formCollection["recipename"],
                Id   = Convert.ToInt32(formCollection["id"])
            };

            recipeRepository.Edit(recipe);
            return(View(recipe));
        }