public async Task <ActionResult> ViewClaims(String id)
        {
            var user = await userManager.FindByIdAsync(id);

            var userRoles = await userManager.GetRolesAsync(id);

            var userclaims = new List <Claim>();

            foreach (var role in userRoles)
            {
                var roleClaims = await roleManager.GetClaimsAsync(role);

                userclaims.AddRange(roleClaims);
            }

            var claimGroups = claimedActionsProvider.GetClaimGroups();

            var viewModel = new UserClaimsViewModel()
            {
                UserName = user.UserName,
            };

            foreach (var claimGroup in claimGroups)
            {
                var claimGroupModel = new UserClaimsViewModel.ClaimGroup()
                {
                    GroupId               = claimGroup.GroupId,
                    GroupName             = claimGroup.GroupName,
                    GroupClaimsCheckboxes = claimGroup.Claims
                                            .Select(c => new SelectListItem()
                    {
                        Value    = String.Format("{0}#{1}", claimGroup.GroupId, c),
                        Text     = c,
                        Selected = userclaims.Any(ac => ac.Type == claimGroup.GroupId.ToString() && ac.Value == c)
                    }).ToList()
                };
                viewModel.ClaimGroups.Add(claimGroupModel);
            }

            return(View(viewModel));
        }
        public async Task<ActionResult> ViewClaims(String id)
        {
            var user = await userManager.FindByIdAsync(id);

            var userRoles = await userManager.GetRolesAsync(id);
            var userclaims = new List<Claim>();
            foreach (var role in userRoles)
            {
                var roleClaims = await roleManager.GetClaimsAsync(role);

                userclaims.AddRange(roleClaims);
            }

            var claimGroups = claimedActionsProvider.GetClaimGroups();

            var viewModel = new UserClaimsViewModel()
            {
                UserName = user.UserName,
            };

            foreach (var claimGroup in claimGroups)
            {
                var claimGroupModel = new UserClaimsViewModel.ClaimGroup()
                {
                    GroupId = claimGroup.GroupId,
                    GroupName = claimGroup.GroupName,
                    GroupClaimsCheckboxes = claimGroup.Claims
                        .Select(c => new SelectListItem()
                        {
                            Value = String.Format("{0}#{1}", claimGroup.GroupId, c),
                            Text = c,
                            Selected = userclaims.Any(ac => ac.Type == claimGroup.GroupId.ToString() && ac.Value == c)
                        }).ToList()
                };
                viewModel.ClaimGroups.Add(claimGroupModel);
            }

            return View(viewModel);
        }