Esempio n. 1
0
        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)));
        }
Esempio n. 2
0
        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));
        }