public ActionResult AddUserAccount(UserAccountModel model) { using (var proxy = new UserServiceClient()) { var user = model.ConvertToDto(); var createdUsers = proxy.CreateUsers(new List<UserDto> { user }.ToArray()); if (model.Role.Id != Guid.Empty.ToString()) proxy.AssignRole(new Guid(createdUsers[0].Id), new Guid(model.Role.Id)); return RedirectToSuccess("创建用户账户成功!", "UserAccounts", "Admin"); } }
public ActionResult EditUserAccount(UserAccountModel model) { using (var proxy = new UserServiceClient()) { var user = model.ConvertToDto(); proxy.UpdateUsers(new List<UserDto> { user }.ToArray()); if (model.Role.Id != Guid.Empty.ToString()) proxy.AssignRole(new Guid(model.Id), new Guid(model.Role.Id)); else proxy.UnassignRole(new Guid(model.Id)); return RedirectToSuccess("更新用户账户成功!", "UserAccounts", "Admin"); } }
public ActionResult Manage(UserAccountModel model) { using(var proxy = new UserServiceClient()) { var userDto = model.ConvertToDto(); proxy.UpdateUsers(new List<UserDto>() { userDto }.ToArray()); return RedirectToSuccess("更新账户信息成功!", "Account", "Account"); } }