Esempio n. 1
0
        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 }));
        }
Esempio n. 2
0
        public IActionResult Edit([FromForm] Product product)
        {
            product.Energy *= 10;

            _ctx.Update(product);
            _ctx.SaveChanges();

            var model = _ctx.Products.ToList();

            return(RedirectToAction(nameof(Index)));
        }