public ActionResult Update(User user) { var createdUser = _iFUser.Update(UserId, user); _iFUserRole.Create(UserId, createdUser.UserId, user.UserRoles); return(RedirectToAction("Index")); }
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)); }
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")); } }