public async Task <StudentInterventionAssociation> CreateAssociation(ScoringInterventionPostBody body) { var odsApi = await _odsApiClientProvider.NewResourcesClient(); var interventionv3 = await odsApi.Get <InterventionModelv3>($"interventions/{body.InterventionId}"); var studentIntervention = new StudentInterventionAssociationv3 { InterventionEffectivenesses = null, InterventionReference = new InterventionReferencev3 { EducationOrganizationId = interventionv3.EducationOrganizationReference.EducationOrganizationId, InterventionIdentificationCode = interventionv3.InterventionIdentificationCode, }, StudentReference = new StudentReferencev3 { StudentUniqueId = body.StudentUniqueId, }, }; var response = await odsApi.Post("studentInterventionAssociations", studentIntervention); await odsApi.HandleHttpResponse(response); // TODO Store in cache return(studentIntervention.MapToStudentInterventionAssociation()); }
public static StudentInterventionAssociation MapToStudentInterventionAssociation(this StudentInterventionAssociationv3 a) { return(new StudentInterventionAssociation { CohortReference = a.CohortReference?.MapToStudentInterventionAssociationCohortReference(), DiagnosticStatement = null, // TODO Check Id = a.Id, InterventionEffectivenesses = a.InterventionEffectivenesses?.Select(b => b.MapToStudentInterventionAssociationInterventionEffectivenessesItem()).ToList(), InterventionReference = a.InterventionReference?.MapToStudentInterventionAssociationInterventionReference(), StudentReference = a.StudentReference?.MapToStudentInterventionAssociationStudentReference(), _etag = a._etag, }); }