Ejemplo n.º 1
0
        public ActionResult EditABlogger(string id)
        {
            BlogManager manager = BlogManagerFactory.Create();

            var bloggerToEdit = manager.GetBlogger(id);
            var editVM        = new EditUserViewModel();

            editVM.SetUser(bloggerToEdit);

            return(View(editVM));
        }
        public async Task <ActionResult> EditUser(string id)
        {
            var editVm = new EditUserViewModel();
            var user   = UserManager.FindById(id);

            editVm.Roles = RoleManager.Roles.Select(r => new SelectListItem {
                Text = r.Name, Value = r.Id
            }).ToList();
            editVm.SelectedRoleId = user.Roles.ElementAt(0).RoleId;
            editVm.SetUser(user);

            return(View(editVm));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> EditUser(string id)
        {
            TheCodingVineDbContext     db      = new TheCodingVineDbContext();
            UserManager <AppUser>      userMgr = new UserManager <AppUser>(new UserStore <AppUser>(db));
            RoleManager <IdentityRole> roleMgr = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(db));
            var vm   = new EditUserViewModel();
            var user = db.GetBlogger(id);

            vm.Roles = RoleManager.Roles.Select(r => new SelectListItem {
                Text = r.Name, Value = r.Id
            }).ToList();

            vm.SelectedRoleId = user.Roles.ElementAt(0).RoleId;

            vm.SetUser(user);

            return(View(vm));
        }