Exemplo n.º 1
0
        public async Task OnGetAsync()
        {
            UserRoles        = new Dictionary <string, string>();
            ApplicationUsers = await _repository.GetAllUsersAsync();

            IList <ApplicationUser> AllUsers;

            AllUsers = await _repository.GetAllUsersAsync();

            UserRoles = await _repository.GetUsersByRoleAsync("Judge");

            foreach (var user in AllUsers)
            {
                if (!UserRoles.ContainsKey(user.Email))
                {
                    ApplicationUsers.Remove(user);
                }
            }
        }
Exemplo n.º 2
0
        async Task DeleteConfirmation(UserDetailsDto user)
        {
            bool ok = (await DialogService.Confirm("Are you sure to delete user?", "Delete User", new ConfirmOptions()
            {
                OkButtonText = "Yes", CancelButtonText = "No"
            })).GetValueOrDefault();

            if (ok)
            {
                var result = await AuthenticationApiService.DeleteUserAsync(user.Id);

                if (result.IsSuccessful)
                {
                    ApplicationUsers.Remove(user);
                    await UsersGrid.Reload();
                }
                else
                {
                    UtilityServices.ShowNotification(NotificationSeverity.Error, "Delete User failed", result.Errors.ToArray());
                    NavigationManager.NavigateTo("/users", true);
                }
            }
        }
Exemplo n.º 3
0
        public async Task OnGetAsync()
        {
            UserRoles        = new Dictionary <string, string>();
            ApplicationUsers = await _repository.GetAllUsersAsync();

            IList <ApplicationUser> AllUsers;

            AllUsers = await _repository.GetAllUsersAsync();

            UserRoles = await _repository.GetAllUserRolesAsync();

            foreach (var user in AllUsers)
            {
                if (!UserRoles.ContainsKey(user.Email))
                {
                    ApplicationUsers.Remove(user);
                }
            }
            UsersRoles = new Dictionary <string, IList <string> >();
            foreach (var user in AllUsers)
            {
                UsersRoles.Add(user.Email, await _userManager.GetRolesAsync(user));
            }
        }