public ActionResult Edit(UserModel userModel) { try { UserDAO.UpdateUser(userModel); return RedirectToAction("Index", "Home"); } catch { return View(); } }
public static void UpdateUser(UserModel userModel) { var storageDbEntities = new StorageDBEntities(); User user = storageDbEntities.Users.Where(u => u.ID == userModel.ID).FirstOrDefault(); if (user != null) { user.Name = userModel.Name; user.Surname = userModel.Surname; } storageDbEntities.SaveChanges(); }