public ActionResult SaveOrUpdateAjax([ModelBinder(typeof(JSonBinder))] EditUserModel editUserModel) { if (ModelState.IsValid) { using (IUnitOfWork unitOfWork = _unitOfWorkFactory.Create()) { User user = _userService.SaveOrUpdate(editUserModel.ToUser()); unitOfWork.Commit(); } return(Json(new { result = "Success" })); } return(Json(new { error = "Invalid" })); }
public ActionResult SaveOrUpdate(EditUserModel editUserModel) { if (ModelState.IsValid) { using (IUnitOfWork unitOfWork = _unitOfWorkFactory.Create()) { User user = _userService.SaveOrUpdate(editUserModel.ToUser()); unitOfWork.Commit(); } return(RedirectToAction("Index")); } return(View("DetailsUser", editUserModel)); }
public virtual ActionResult Edit(EditUserModel model, string @return) { var data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { UserManager.Update(model.UserName, model.ToUser()); resultData.RedirectUrl = @return; }); } return(Json(data)); }