public async Task <IActionResult> ManageClaims(string userId)
        {
            var user = await _userManager.FindByIdAsync(userId);

            var claims = await _userManager.GetClaimsAsync(user);

            var viewModel = new ClaimsManagementViewModel
            {
                UserId   = user.Id,
                Claims   = claims,
                Username = user.UserName
            };

            return(View("ClaimsManagement", viewModel));
        }
        public async Task <IActionResult> RemoveClaim([FromForm] string userId, string claimTypeToRemove, string claimValueToRemove)
        {
            var user = await _userManager.FindByIdAsync(userId);

            var identityResult = await _userManager.RemoveClaimAsync(user, new Claim(claimTypeToRemove, claimValueToRemove));

            if (!identityResult.Succeeded)
            {
                ModelState.AddModelError("ASP NET Core Identity", "Something went wrong when attempting to remove a claim");
            }

            var viewModel = new ClaimsManagementViewModel
            {
                UserId   = userId,
                Claims   = await _userManager.GetClaimsAsync(user),
                Username = user.UserName
            };

            return(View("ClaimsManagement", viewModel));
        }
        public async Task <IActionResult> AddClaim(ClaimsManagementViewModel viewModel)
        {
            var user = await _userManager.FindByIdAsync(viewModel.UserId);

            if (ModelState.IsValid)
            {
                var identityResult = await _userManager.AddClaimAsync(user, new Claim(viewModel.ClaimType, viewModel.ClaimValue));

                if (identityResult.Succeeded)
                {
                    viewModel.ClaimType  = string.Empty;
                    viewModel.ClaimValue = string.Empty;
                }
                else
                {
                    ModelState.AddModelError("ASP NET Core Identity", "Something went wrong when attempting to add a claim");
                }
            }

            viewModel.Claims = await _userManager.GetClaimsAsync(user);

            return(View("ClaimsManagement", viewModel));
        }