public async Task <IActionResult> GetPendingKeyContacts() { var callingUserId = JWTAttributesService.GetSubject(Request); var contacts = await _keyContactRepository.FindByUserId(callingUserId); var list = new List <KeyContacts>(); foreach (var contact in contacts) { var x = (await _keyContactRepository.FindByOrgId(contact.OrgId)).Where(x => x.UserId != callingUserId && x.IsPending == true); list.AddRange(x); } return(Ok(list)); }
public async Task <IActionResult> FetchAdminRequests() { var userId = JWTAttributesService.GetSubject(Request); var orgs = await _keyContactRepo.FindByUserId(userId); var pendingrequests = new List <OrganisationMember>(); foreach (var o in orgs) { if (!o.IsPending) { var allRequests = _orgMemberRepository.GetAllPendingRequests(o.OrgId); pendingrequests.AddRange(allRequests.Where(x => x.Status != OrganisationMembersStatus.JOINED && x.Status != OrganisationMembersStatus.DENIED)); } } return(Ok(pendingrequests)); }