private void AddStandards(dynamic standards, List <ProviderApprenticeship> providerstandards) { //Get Provider's standard foreach (var standard in standards) { var sCode = $"{standard.standardCode}"; if (_standardsfromApi.Any(x => x.Id == sCode) == false) { continue; } var sname = _standardsfromApi.FirstOrDefault(a => a.Id == sCode); var providersstandard = new ProviderApprenticeship { ApprenticeshipType = ApprenticeshipType.Standard, ApprenticeshipId = sCode, ApprenticeshipName = sname.Title, ApprenticeshipTrainingLocations = new List <ApprenticeshipTrainingLocation>() }; var providersstandardlocations = standard.locations; foreach (var providersstandardlocation in providersstandardlocations) { var apprenticeshipTrainingLocation = new ApprenticeshipTrainingLocation { LocationId = providersstandardlocation.id, DeliveryModes = new List <string>() }; var apprenticeshipdeliveryModes = providersstandardlocation.deliveryModes; apprenticeshipTrainingLocation.DeliveryModes.AddRange(apprenticeshipdeliveryModes.ToObject <List <string> >()); providersstandard.ApprenticeshipTrainingLocations.Add(apprenticeshipTrainingLocation); } providerstandards.Add(providersstandard); } }
private void AddFrameworks(dynamic frameworks, List <ProviderApprenticeship> providerframeworks) { //Get Provider's framework foreach (var framework in frameworks) { var fid = $"{framework.frameworkCode}-{framework.progType}-{framework.pathwayCode}"; if (_frameworksfromApi.Any(x => x.Id == fid) == false) { continue; } var fname = _frameworksfromApi.FirstOrDefault(a => a.Id == fid); var providersframework = new ProviderApprenticeship { ApprenticeshipType = ApprenticeshipType.Framework, ApprenticeshipId = fid, ApprenticeshipName = fname.FrameworkName, ApprenticeshipTrainingLocations = new List <ApprenticeshipTrainingLocation>() }; var providersframeworklocations = framework.locations; foreach (var providersframeworklocation in providersframeworklocations) { var apprenticeshipTrainingLocation = new ApprenticeshipTrainingLocation { LocationId = providersframeworklocation.id, DeliveryModes = new List <string>() }; var apprenticeshipdeliveryModes = providersframeworklocation.deliveryModes; apprenticeshipTrainingLocation.DeliveryModes.AddRange(apprenticeshipdeliveryModes.ToObject <List <string> >()); providersframework.ApprenticeshipTrainingLocations.Add(apprenticeshipTrainingLocation); } providerframeworks.Add(providersframework); } }