public void Edit(EditRecipeViewModel editModel) { var recipe = recipes.FirstOrDefault(r => r.Id == editModel.Id); recipe.Name = editModel.Name; recipe.NameOfPlate = editModel.NameOfPlate; recipe.Ingredients = editModel.Ingredients; recipe.HowToDo = editModel.HowToDo; }
public void Edit(EditRecipeViewModel editModel) { var recipe = _context.Recipes.FirstOrDefault(r => r.Id == editModel.Id); recipe.Name = editModel.Name; recipe.NameOfPlate = editModel.NameOfPlate; recipe.Ingredients = editModel.Ingredients; recipe.HowToDo = editModel.HowToDo; _context.SaveChanges(); }
public IActionResult Edit(EditRecipeViewModel recipeModel) { _repository.Edit(recipeModel); return RedirectToAction("Published"); }