public BaseResponse <UserManager> editUser(UserManagerCreateRequest condtion, string Id = null) { var thisUser = UserManager.getUserById(User.Identity.Name); UserManager result = null; if (string.IsNullOrEmpty(Id)) { //新增 result = UserManager.create(condtion); //记录到日志 //操作员 UserLog.create(string.Format("创建用户[{0}]", result.getNameString()), "添加用户", thisUser); //被创建 UserLog.create(string.Format("用户由[{0}]创建", thisUser.getNameString()), "添加用户", result); } else { //编辑 result = UserManager.getUserById(Id); result.edit(new UserManagerEditRequest { fullName = condtion.fullName, mobilePhone = condtion.mobilePhone, roleNames = condtion.roleNames }); //操作员 UserLog.create(string.Format("编辑用户信息[{0}]", result.getNameString()), "编辑用户信息", thisUser); //被编辑 UserLog.create(string.Format("用户信息被[{0}]编辑", thisUser.getNameString()), "编辑用户信息", result); } return(BaseResponse.getResult(result, "操作成功")); }
public ActionResult editUser(UserManagerCreateRequest condtion, string Id = null, string pageId = null) { if (!string.IsNullOrEmpty(Id)) { UserManager user = UserManager.getUserById(Id); condtion.fullName = user.fullName; condtion.mobilePhone = user.mobilePhone; condtion.roleNames = user.rolesList.ToArray(); } ViewBag.Id = Id; ViewBag.pageId = getPageId(pageId); return(View(condtion)); }