示例#1
0
        public ActionResult Index()
        {
            List <AdminIndexViewModel> model  = new List <AdminIndexViewModel>();
            UserRolesHelper            helper = new UserRolesHelper();

            foreach (var User in dB.Users)
            {
                AdminIndexViewModel vm = new AdminIndexViewModel();
                vm.User  = User;
                vm.Roles = helper.ListRolesForUser(User.Id);
                model.Add(vm);
            }
            return(View(model));
        }
示例#2
0
        //GET: EditUser
        public ActionResult EditUser(string id)
        {
            var             user       = dB.Users.Find(id);
            AdminModel      AdminModel = new AdminModel();
            UserRolesHelper helper     = new UserRolesHelper();
            var             selected   = helper.ListRolesForUser(id);

            AdminModel.Roles = new MultiSelectList(dB.Roles, "Name", "Name", selected);
            AdminModel.User  = new ApplicationUser
            {
                Id       = user.Id,
                FullName = user.FullName
            };
            return(View(AdminModel));

            //new { id = mod.User.Id })
        }