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); } } }
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); } } }
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)); } }