public async Task <IActionResult> OnPostUpdate(string roleId, string roleName)
        {
            GetRole = await _roleManager.FindByIdAsync(roleId);

            GetRole.Name = roleName;

            Claims = await _roleManager.GetClaimsAsync(GetRole) as List <Claim>;

            foreach (var roleClaim in RoleClaims)
            {
                var testselect = roleClaim.Selected;
                var testclami  = roleClaim.claim;
                if (roleClaim.Selected && !Claims.Exists(x => x.Type == roleClaim.claim))
                {
                    await _roleManager.AddClaimAsync(GetRole, new Claim(roleClaim.claim, roleClaim.claim));
                }
                else if (!roleClaim.Selected && Claims.Exists(x => x.Type == roleClaim.claim))
                {
                    await _roleManager.RemoveClaimAsync(GetRole, Claims.Find(x => x.Type.Contains(roleClaim.claim)));
                }
            }
            foreach (var userClaim in UserClaims)
            {
                var testselect = userClaim.Selected;
                var testclami  = userClaim.claim;
                if (userClaim.Selected && !Claims.Exists(x => x.Type == userClaim.claim))
                {
                    await _roleManager.AddClaimAsync(GetRole, new Claim(userClaim.claim, userClaim.claim));
                }
                else if (!userClaim.Selected && Claims.Exists(x => x.Type == userClaim.claim))
                {
                    await _roleManager.RemoveClaimAsync(GetRole, Claims.Find(x => x.Type.Contains(userClaim.claim)));
                }
            }
            foreach (var versionClaim in VersionClaims)
            {
                var testselect = versionClaim.Selected;
                var testclami  = versionClaim.claim;
                if (versionClaim.Selected && !Claims.Exists(x => x.Type == versionClaim.claim))
                {
                    await _roleManager.AddClaimAsync(GetRole, new Claim(versionClaim.claim, versionClaim.claim));
                }
                else if (!versionClaim.Selected && Claims.Exists(x => x.Type == versionClaim.claim))
                {
                    await _roleManager.RemoveClaimAsync(GetRole, Claims.Find(x => x.Type.Contains(versionClaim.claim)));
                }
            }

            await _roleManager.UpdateAsync(GetRole);

            return(RedirectToPage("Index"));
        }
        //public void VersionClaimTypes()
        //{
        //    AllVersionClaims = new List<string>
        //    {
        //        "CanViewVersions",
        //        "CanAddVersions",
        //        "CanEditVersions",
        //        "CanDeleteVersions"
        //    };
        //}

        public async Task <IActionResult> OnGetAsync()
        {
            List <RoleClaim> roleClaims = new List <RoleClaim>();
            List <RoleClaim> userClaims = new List <RoleClaim>();
            //List<RoleClaim> versionClaims = new List<RoleClaim>();
            var RoleToUpdate = TempData["UpdateRole"].ToString();

            GetRole = await _roleManager.FindByIdAsync(RoleToUpdate);

            Claims = await _roleManager.GetClaimsAsync(GetRole) as List <Claim>;

            RoleClaimTypes();
            UserClaimTypes();
            //VersionClaimTypes();

            foreach (var claim in AllRoleClaims)
            {
                if (claim.Contains("Roles"))
                {
                    /////
                    if (Claims.Exists(x => x.Type == claim))
                    {
                        RoleClaim newClaim = new RoleClaim
                        {
                            claim    = claim,
                            Selected = true
                        };
                        roleClaims.Add(newClaim);
                    }
                    else
                    {
                        RoleClaim newClaim = new RoleClaim
                        {
                            claim    = claim,
                            Selected = false
                        };
                        roleClaims.Add(newClaim);
                    }
                    ////
                }
            }
            foreach (var claim in AllUserClaims)
            {
                if (claim.Contains("Users"))
                {
                    /////
                    if (Claims.Exists(x => x.Type == claim))
                    {
                        RoleClaim newClaim = new RoleClaim
                        {
                            claim    = claim,
                            Selected = true
                        };
                        userClaims.Add(newClaim);
                    }
                    else
                    {
                        RoleClaim newClaim = new RoleClaim
                        {
                            claim    = claim,
                            Selected = false
                        };
                        userClaims.Add(newClaim);
                    }
                    ////
                }
            }

            //foreach (var claim in AllVersionClaims)
            //{
            //    if (claim.Contains("Version"))
            //    {
            //        /////
            //        if (Claims.Exists(x => x.Type == claim))
            //        {
            //            RoleClaim newClaim = new RoleClaim
            //            {
            //                claim = claim,
            //                Selected = true
            //            };
            //            versionClaims.Add(newClaim);
            //        }
            //        else
            //        {
            //            RoleClaim newClaim = new RoleClaim
            //            {
            //                claim = claim,
            //                Selected = false
            //            };
            //            versionClaims.Add(newClaim);
            //        }
            //        ////
            //    }
            //}

            RoleClaims = roleClaims;
            UserClaims = userClaims;
            //VersionClaims = versionClaims;

            return(Page());
        }