Пример #1
0
        public ActionResult Update(User user)
        {
            var createdUser = _iFUser.Update(UserId, user);

            _iFUserRole.Create(UserId, createdUser.UserId, user.UserRoles);
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public JsonResult EditUser(User user)
        {
            try
            {
                _iFUser.Update(user);

                _iFUserRole.Update(user.Roles, user.UserId);
            }
            catch (Exception ex)
            {
                return(Json(ex.ToString()));
            }
            return(Json(string.Empty));
        }
Пример #3
0
 public ActionResult Update(User user)
 {
     try
     {
         var createdUser = _iFUser.Update(UserId, user);
         _iFUserRole.Create(UserId, createdUser.UserId, user.UserRoles);
         if (ModelState.IsValid)
         {
             TempData["message"] = "User has been updated, successfully!";
         }
         return(RedirectToAction("Create"));
     }
     catch (Exception)
     {
         if (ModelState.IsValid)
         {
             // Do your stuff
             TempData["message"] = "Opps! Something went wrong. Please, try again.";
         }
         return(RedirectToAction("Create"));
     }
 }