示例#1
0
        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" }));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }