Example #1
0
        public ActionResult Edit(UserModel userModel)
        {
            try
            {
                UserDAO.UpdateUser(userModel);

                return RedirectToAction("Index", "Home");
            }
            catch
            {
                return View();
            }
        }
Example #2
0
        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();
        }