public IActionResult Update(int id, EditDataBaseViewModel model) { if (ModelState.IsValid) { var company = _databaseContext.DataBase.First(g => g.Id == id); company.Name = model.DataBase.Name; TempData["Success"] = true; _databaseContext.SaveChanges(); } return(RedirectToAction(nameof(Index))); }
public ViewResult Edit(int id) { var db = _databaseContext.DataBase.First(g => g.Id == id); ViewData["Success"] = TempData["Success"]; var model = new EditDataBaseViewModel { DataBase = db }; return(View(model)); }