Exemple #1
0
 public ActionResult EditUserAccount(string id)
 {
     using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>())
     {
         var user  = proxy.Channel.GetUserByKey(new Guid(id), QuerySpec.VerboseOnly);
         var model = UserAccountModel.CreateFromDataObject(user);
         var roles = proxy.Channel.GetRoles();
         if (roles == null)
         {
             roles = new RoleDataObjectList();
         }
         roles.Insert(0, new RoleDataObject {
             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));
     }
 }
Exemple #2
0
 public ActionResult EditUserAccount(string id)
 {
     using (var proxy = this.Service <IUserService>())
     {
         var user  = proxy.GetUserByKey(new Guid(id));
         var model = UserAccountModel.CreateFromDataObject(user);
         var roles = proxy.GetRoles();
         if (roles == null)
         {
             roles = new List <Role>();
         }
         roles.Insert(0, new Role {
             ID = Guid.Empty, 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));
     }
 }
Exemple #3
0
 public ActionResult Account()
 {
     using (var proxy = new ServiceProxy <IUserService>())
     {
         var model = proxy.Channel.GetUserByKey(UserID, QuerySpec.Empty);
         return(View(UserAccountModel.CreateFromDataObject(model)));
     }
 }
Exemple #4
0
 public ActionResult UserAccounts()
 {
     using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>())
     {
         var users = proxy.Channel.GetUsers(QuerySpec.VerboseOnly);
         var model = new List <UserAccountModel>();
         users.ForEach(u => model.Add(UserAccountModel.CreateFromDataObject(u)));
         return(View(model));
     }
 }
Exemple #5
0
 public ActionResult UserAccounts()
 {
     using (var proxy = this.Service <IUserService>())
     {
         var users = proxy.GetUsers();
         var model = new List <UserAccountModel>();
         users.ForEach(u => model.Add(UserAccountModel.CreateFromDataObject(u)));
         return(View(model));
     }
 }
Exemple #6
0
        public ActionResult Account()
        {
            var model = RF.Service <IUserService>().GetUserByKey(UserID);

            return(View(UserAccountModel.CreateFromDataObject(model)));
        }