コード例 #1
0
        public async Task <IActionResult> PendingUsers()
        {
            GetterAll      getter  = new GetterAll(_getterUtils, _context, _signInManager, _userManager);
            List <Usuario> pending = new List <Usuario>();

            foreach (var item in getter.GetAll("Usuario"))
            {
                if ((await _userManager.GetClaimsAsync(item as Usuario)).Any(c => c.Type == "Pending" && c.Value == "true"))
                {
                    pending.Add(item as Usuario);
                }
            }

            PendingUsersViewModel vm = new PendingUsersViewModel()
            {
                Usuarios = pending,
            };

            return(View(vm));
        }
コード例 #2
0
        public async Task <IActionResult> PendingUsers(PendingUsersViewModel vm)
        {
            var user = await _userManager.FindByIdAsync(vm.userID);

            await _userManager.RemoveClaimAsync(user, new Claim("Pending", "true"));

            await _userManager.AddClaimAsync(user, new Claim("Pending", "false"));

            _context.Commit();

            GetterAll      getter  = new GetterAll(_getterUtils, _context, _signInManager, _userManager);
            List <Usuario> pending = new List <Usuario>();

            foreach (var item in getter.GetAll("Usuario"))
            {
                if ((await _userManager.GetClaimsAsync(item as Usuario)).Any(c => c.Type == "Pending" && c.Value == "true"))
                {
                    pending.Add(item as Usuario);
                }
            }
            return(RedirectToAction("PendingUsers", "Admin"));
        }