public async Task <IActionResult> AddKeyContact([FromRoute] string orgId) { await _keyContactRepository.InsertOne(new KeyContacts() { Id = Guid.NewGuid().ToString(), OrgId = orgId, UserId = JWTAttributesService.GetSubject(Request), UserEmail = JWTAttributesService.GetEmail(Request) }); return(Ok()); }
public async Task <IActionResult> VerifyPendingOrganisation(string id) { var org = await _pendingOrgRepository.FindById(id); if (JWTAttributesService.GetSubject(Request) != _configuration["Admin:UserId"]) { return(Forbid()); } Organisation newOrg = new Organisation { Id = org.Id, Description = org.Description, CharityNumber = org.CharityNumber, Name = org.Name, ServicesIds = org.ServicesIds, Url = org.Url }; await _orgRepository.InsertOne(newOrg); await _keyContactRepo.InsertOne(new KeyContacts() { Id = Guid.NewGuid().ToString(), OrgId = org.Id, UserId = org.UserId, UserEmail = org.UserEmail }); await _pendingOrgRepository.DeleteOne(org); var publishedOrg = _registerManagmentServiceClient.CreateOrganisation(org); await _sendgridSender.SendOrgApprovedEmail( new SendGrid.Helpers.Mail.EmailAddress("*****@*****.**"), new SendGrid.Helpers.Mail.EmailAddress(org.UserEmail), org.Name, org.Id ); return(Accepted(publishedOrg)); }