Exemple #1
0
        public ViewResult AddUserToRole()
        {
            var model = new UserRoleViewModel();

            PopulateAddNewRoleDropdown();

            return View(model);
        }
Exemple #2
0
        public async Task<ViewResult> AddUserToRole(UserRoleViewModel model)
        {
            PopulateAddNewRoleDropdown();

            if (ModelState.IsValid)
            {
                var userManger = HttpContext.GetOwinContext().Get<ApplicationUserManager>();
                var result = await userManger.AddToRoleAsync(model.SelectUser, model.SelectRole);
                if (result.Succeeded)
                {
                    
                }
            }
            
            return View(model);
        }