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 async Task <StudentInterventionAssociation> CreateAssociation(ScoringInterventionPostBody body) { var ods = await _odsApiClientProvider.NewResourcesClient(); var intervention = await ods.Get <Intervention>($"interventions/{body.InterventionId}"); var studentInterventionAssociation = new StudentInterventionAssociation { Id = "", InterventionReference = new StudentInterventionAssociationInterventionReference { EducationOrganizationId = intervention.EducationOrganizationReference.EducationOrganizationId, IdentificationCode = intervention.IdentificationCode, }, StudentReference = new StudentInterventionAssociationStudentReference { StudentUniqueId = body.StudentUniqueId, }, }; var response = await ods.Post("studentInterventionAssociations", studentInterventionAssociation); await ods.HandleHttpResponse(response); return(studentInterventionAssociation); }
public async Task <StudentInterventionAssociation> CreateAssociation([FromBody] ScoringInterventionPostBody body) { return(await ScoringInterventionsService.CreateAssociation(body)); }