Exemple #1
0
 public static MedicalChartDTO MedicalChartToDTO(MedicalChart medicalChart)
 {
     return(new MedicalChartDTO
     {
         Id = medicalChart.Id,
     });
 }
        public void Create(int patientId)
        {
            var patient            = _context.Patients.Find(patientId);
            TeethSettingsDTO teeth = _settings.Value;
            var medicalChart       = new MedicalChart
            {
                Patient = patient
            };

            medicalChart.Teeth = new List <Tooth>();

            foreach (ToothSettingsDTO toothSettings in teeth.Teeth)
            {
                Tooth tooth = new Tooth()
                {
                    Url      = toothSettings.Url,
                    Category = toothSettings.Category,
                    Number   = toothSettings.Number,
                    Order    = toothSettings.Order
                };
                medicalChart.Teeth.Add(tooth);
            }

            _context.MedicalCharts.Add(medicalChart);
            _context.SaveChanges();
        }