LoadDataAsync(Guid projectId, Guid projectTenantId) { var guestContextTask = _projectGuestContextService.GetProjectGuestContextAsync(); var projectUsersTask = _serviceToServiceProjectAccessApi.GetProjectMemberUserIdsAsync(projectId, MemberRoleFilter.FullUser, new List <KeyValuePair <string, string> >() { HeaderKeys.CreateTenantHeaderKey(projectTenantId) }); await Task.WhenAll(guestContextTask, projectUsersTask); var guestContext = await guestContextTask; var projectUsersResponse = await projectUsersTask; return(guestContext, projectUsersResponse); }
private async Task <IQueryable <User> > AddFilterByProjectToQuery(IQueryable <User> query, UserFilteringOptions userFilteringOptions) { var projectUserIdsResponse = await _projectApi.GetProjectMemberUserIdsAsync(userFilteringOptions.UserGroupingId, MemberRoleFilter.FullUser); if (!projectUserIdsResponse.IsSuccess() || projectUserIdsResponse.Payload == null) { _logger.Error($"Could not find members for user grouping id: {userFilteringOptions.UserGroupingId}"); return(query); } var usersInProject = projectUserIdsResponse.Payload.ToList(); query = userFilteringOptions.ExcludeUsersInGroup ? query.Where(user => !usersInProject.Contains(user.Id ?? Guid.Empty)) : query.Where(user => usersInProject.Contains(user.Id ?? Guid.Empty)); return(query); }