private async Task <InterventionModelv3> CreateSampleInterventionV3(OdsApiClient client)
 {
     return(new InterventionModelv3
     {
         InterventionIdentificationCode = KeyGenerator.New(30),
         EducationOrganizationReference = await GetSampleEducationOrganizationReferenceV3(client),
         BeginDate = DateTime.Now.ToString("yyyy-MM-dd"),
         DeliveryMethodDescriptor = await GetSampleDeliveryMethodDescriptorV3(client),
         InterventionClassDescriptor = await GetSampleInterventionClassDescriptorV3(client),
     });
 }
 private async Task <Intervention> CreateSampleInterventionV2(OdsApiClient client)
 {
     return(new Intervention
     {
         IdentificationCode = KeyGenerator.New(30),
         EducationOrganizationReference = await GetSampleEducationOrganizationReferenceV2(client),
         BeginDate = DateTime.Now,
         DeliveryMethodType = await GetSampleDeliveryMethodDescriptorV2(client),
         ClassType = await GetSampleInterventionClassDescriptorV2(client),
     });
 }
        private async Task <string> GetSampleInterventionClassDescriptorV3(OdsApiClient client)
        {
            var descriptor = await client.Get <IList <InterventionClassDescriptorv3> >("interventionClassDescriptors");

            return(descriptor.First().CodeValue.MapToInterventionClassDescriptorTypeV3());
        }
        private async Task <string> GetSampleInterventionClassDescriptorV2(OdsApiClient client)
        {
            var descriptor = await client.Get <IList <Dictionary <string, object> > >("interventionClassTypes");

            return(descriptor.First()["codeValue"].ToString());
        }
        private async Task <InterventionEducationOrganizationReference> GetSampleEducationOrganizationReferenceV2(OdsApiClient client)
        {
            try
            {
                var localEducationAgencies = await client.Get <IList <LocalEducationAgency> >("localEducationAgencies");

                return(new InterventionEducationOrganizationReference
                {
                    EducationOrganizationId = localEducationAgencies.First().LocalEducationAgencyId,
                });
            }
            catch
            {
                var schools = await client.Get <IList <School> >("schools");

                return(new InterventionEducationOrganizationReference
                {
                    EducationOrganizationId = schools.First().SchoolId,
                });
            }
        }
        private async Task <string> GetSampleDeliveryMethodDescriptorV3(OdsApiClient client)
        {
            var descriptors = await client.Get <IList <DeliveryMethodDescriptorv3> >("deliveryMethodDescriptors");

            return(descriptors.First().CodeValue.MapToDeliveryMethodDescriptorV3());
        }
        private async Task <string> GetSampleDeliveryMethodDescriptorV2(OdsApiClient client)
        {
            var descriptors = await client.Get <IList <Dictionary <string, object> > >("deliveryMethodTypes");

            return(descriptors.First()["codeValue"].ToString());
        }