Example #1
0
        public async Task DeleteAssociation(ScoringInterventionDeleteBody body)
        {
            string studentInterventionAssociationId;

            if (string.IsNullOrWhiteSpace(body.StudentInterventionAssociationId))
            {
                // Association has just been added from the frontend, so we have to get
                // the created association from the API to be able to get the id

                if (string.IsNullOrWhiteSpace(body.StudentUniqueId))
                {
                    return;
                }

                if (string.IsNullOrWhiteSpace(body.InterventionIdentificationCode))
                {
                    return;
                }

                var foundAssociation = await GetStudentInterventionAssociationByStudentAndIntervention(body.StudentUniqueId, body.InterventionIdentificationCode);

                if (foundAssociation == null)
                {
                    return;
                }

                studentInterventionAssociationId = foundAssociation.Id;
            }
            else
            {
                studentInterventionAssociationId = body.StudentInterventionAssociationId;
            }

            var ods = await _odsApiClientProvider.NewResourcesClient();

            var response = await ods.Delete($"studentInterventionAssociations/{studentInterventionAssociationId}");

            await ods.HandleHttpResponse(response);
        }
Example #2
0
 public async Task DeleteAssociation([FromBody] ScoringInterventionDeleteBody body)
 {
     await ScoringInterventionsService.DeleteAssociation(body);
 }