public ActionResult Account(UserAccountModel model) { using (var proxy = new ServiceProxy <IUserService>()) { var dataObject = model.ConvertToDataObject(); proxy.Channel.UpdateUsers(new UserDataObjectList { dataObject }); return(RedirectToSuccess("更新账户信息成功!", "Account", "Account")); } }
public ActionResult EditUserAccount(UserAccountModel model) { using (var proxy = this.Service <IUserService>()) { var user = model.ConvertToDataObject(); proxy.UpdateUsers(new List <User>() { user }); return(RedirectToSuccess("更新用户账户成功!", "UserAccounts", "Admin")); } }
public ActionResult AddUserAccount(UserAccountModel model) { using (var proxy = this.Service <IUserService>()) { var user = model.ConvertToDataObject(); var createdUsers = proxy.CreateUsers(new List <Domain.Model.User>() { user }); //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 AddUserAccount(UserAccountModel model) { using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>()) { var user = model.ConvertToDataObject(); var createdUsers = proxy.Channel.CreateUsers(new UserDataObjectList { user }); if (model.Role.ID != Guid.Empty.ToString()) { proxy.Channel.AssignRole(new Guid(createdUsers[0].ID), new Guid(model.Role.ID)); } return(RedirectToSuccess("创建用户账户成功!", "UserAccounts", "Admin")); } }
public ActionResult EditUserAccount(UserAccountModel model) { using (var proxy = new ServiceProxy <IUserService>()) { var user = model.ConvertToDataObject(); proxy.Channel.UpdateUsers(new UserDataObjectList { user }); if (model.Role.ID != Guid.Empty.ToString()) { proxy.Channel.AssignRole(new Guid(model.ID), new Guid(model.Role.ID)); } else { proxy.Channel.UnassignRole(new Guid(model.ID)); } return(RedirectToSuccess("更新用户账户成功!", "UserAccounts", "Admin")); } }