public IActionResult Rename(int id, string newName) { var model = _ctx.Recipes.Find(id); model.Name = newName; _ctx.Update(model); _ctx.SaveChanges(); return(RedirectToAction(nameof(Edit), new { id = id })); }
public IActionResult Edit([FromForm] Product product) { product.Energy *= 10; _ctx.Update(product); _ctx.SaveChanges(); var model = _ctx.Products.ToList(); return(RedirectToAction(nameof(Index))); }