public ActionResult Edit(SysUserEdit collection) { if (!ModelState.IsValid) { var item = _sysUserService.GetById(_userInfo.UserId); return View(item); } var user = _sysUserService.GetById(_userInfo.UserId); if (user != null) { user.DisplayName = collection.DisplayName; user.Password = collection.Password; user.Email = collection.Email; user.MobilePhone = collection.MobilePhone; user.Picture = collection.Picture; user.GooglePassword = collection.GooglePassword; user.GoogleUserName = collection.GoogleUserName; _sysUserService.Update(user); _unitOfWork.Commit(); TempData[Alerts.ATTENTION] = "修改成功!"; } else { TempData[Alerts.ATTENTION] = "修改失败!"; } return RedirectToAction("Edit"); }
public ActionResult Edit(SysUserEdit collection) { if (!ModelState.IsValid) { var item = _sysUserService.GetById(_userInfo.UserId); return(View(item)); } var user = _sysUserService.GetById(_userInfo.UserId); if (user != null) { user.DisplayName = collection.DisplayName; user.Password = collection.Password; user.Email = collection.Email; user.MobilePhone = collection.MobilePhone; user.Picture = collection.Picture; user.GooglePassword = collection.GooglePassword; user.GoogleUserName = collection.GoogleUserName; _sysUserService.Update(user); _unitOfWork.Commit(); TempData[Alerts.ATTENTION] = "修改成功!"; } else { TempData[Alerts.ATTENTION] = "修改失败!"; } return(RedirectToAction("Edit")); }