Example #1
0
        private static void ConvertDosage(TargetModel.Dosage to, SourceModel.Dosage from, FhirConverter converter)
        {
            var fromDose = from.DoseAndRate.FirstOrDefault(it => it.Dose != null);
            var fromRate = from.DoseAndRate.FirstOrDefault(it => it.Rate != null);

            to.Dose = fromDose == null ? to.Dose : converter.ConvertElement <DataType, DataType>(fromDose.Dose);
            to.Rate = fromRate == null ? to.Rate : converter.ConvertElement <DataType, DataType>(fromRate.Rate);
        }
 private static void ConvertDosage(TargetModel.Dosage to, SourceModel.Dosage from, FhirConverter converter)
 {
     if (from.Dose != null)
     {
         to.DoseAndRate.Add(new TargetModel.Dosage.DoseAndRateComponent {
             Dose = converter.ConvertElement <DataType, DataType>(from.Dose)
         });
     }
     if (from.Rate != null)
     {
         to.DoseAndRate.Add(new TargetModel.Dosage.DoseAndRateComponent {
             Rate = converter.ConvertElement <DataType, DataType>(from.Rate)
         });
     }
 }