public async Task <IActionResult> AddRole(UsersAddRoleViewModel vm)
        {
            // Allows an Admin to add a Role to another User.

            // Get the user to add a Role to from the ViewModel
            ApplicationUser user = await _userServices.GetUserByIdAsync(vm.UserID);

            // If VM is valid, try to add user to Role.  If successful Redirect to
            // the ViewRoles action.  Otherwise, return to the view with the VM and
            // errors.
            if (ModelState.IsValid)
            {
                var result = await _userManager.AddToRoleAsync(user, vm.NewRole);

                if (result.Succeeded)
                {
                    return(RedirectToAction("ViewRoles"));
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(error.Code, error.Description);
                }
            }
            vm.Username = user.UserName;
            vm.Roles    = _userServices.GetAllRoles();
            return(View(vm));
        }
        public async Task <IActionResult> AddRole(string id)
        {
            // Find the User by id and seed the ViewModel
            ApplicationUser user = await _userServices.GetUserByIdAsync(id);

            if (user != null)
            {
                var vm = new UsersAddRoleViewModel
                {
                    UserID   = id,
                    Roles    = _userServices.GetAllRoles(),
                    Username = user.UserName
                };

                return(View(vm));
            }
            return(RedirectToAction("ViewRoles"));
        }