public ActionResult EditUserAccount(string id) { using (var proxy = new UserServiceClient()) { var user = proxy.GetUserByKey(new Guid(id)); var model = UserAccountModel.CreateFromDto(user); var roles = proxy.GetRoles(); if (roles == null) { roles = new List <RoleDto>().ToArray(); } roles.ToList().Insert(0, new RoleDto() { Id = Guid.Empty.ToString(), Name = "(未指定)", Description = "(未指定)" }); if (model.Role != null) { ViewData["roles"] = new SelectList(roles, "Id", "Name", model.Role.Id); } else { ViewData["roles"] = new SelectList(roles, "Id", "Name", Guid.Empty.ToString()); } return(View(model)); } }
public ActionResult Manage() { using (var proxy = new UserServiceClient()) { var userDto = proxy.GetUserByKey(UserId); return(View(UserAccountModel.CreateFromDto(userDto))); } }
public ActionResult UserAccounts() { using (var proxy = new UserServiceClient()) { var users = proxy.GetUsers(); var model = new List <UserAccountModel>(); users.ToList().ForEach(u => model.Add(UserAccountModel.CreateFromDto(u))); return(View(model)); } }