// GET: Admin/Home/Manage/5
        public async Task <ActionResult> Manage(string id, string email)
        {
            var fullUserStore = UserManager.FullUserStore;
            var claims        = await fullUserStore.GetClaimsAsync(Guid.Parse(id));

            var query = from item in claims
                        where item.Type == ClaimTypes.Role && item.Value == "Developer"
                        select item;

            var adminStore = new IdentityServer3AdminStore();

            ViewBag.Email = email;
            var exists = await adminStore.FindDoesUserExistByUserIdAsync(id);

            if (exists)
            {
                var scopes = await adminStore.FindScopesByUserAsync(id);
            }
            IdentityServerUserModel isum = new IdentityServerUserModel()
            {
                UserId        = id,
                Exists        = exists,
                AllowedScopes = new List <string>(),
                Developer     = query.Any()
            };

            return(View(isum));
        }
        public async Task <ActionResult> Manage(IdentityServerUserModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var fullUserStore = UserManager.FullUserStore;
            var user          = await fullUserStore.FindByIdAsync(Guid.Parse(model.UserId));

            var claim = new Claim(ClaimTypes.Role, "Developer");
            await fullUserStore.AddClaimAsync(user, claim);

            var adminStore             = new IdentityServer3AdminStore();
            IdentityServerUser idsUser = new IdentityServerUser()
            {
                Enabled = true, UserId = model.UserId
            };
            await adminStore.CreateIdentityServerUserAsync(idsUser);

            return(RedirectToAction("Index"));
        }