コード例 #1
0
        public static IRepository <TreatmentEntity> GetInstance()
        {
            if (instance == null)
            {
                lock (rootSync)
                {
                    if (instance == null)
                    {
                        instance = new TreatmentRepository();
                    }
                }
            }

            return(instance);
        }
コード例 #2
0
        public void Delete(DoctorEntity item)
        {
            if (item == null)
            {
                return;
            }

            var treatmentRepository = TreatmentRepository.GetInstance();
            var doctor = medicalEntity.DoctorEntities.FirstOrDefault(x => x.Id == item.Id);

            if (doctor != null)
            {
                if (doctor.Treatments != null && doctor.Treatments.Any())
                {
                    while (doctor.Treatments.Count > 0)
                    {
                        var treatment = doctor.Treatments.LastOrDefault();
                        treatmentRepository.Delete(treatment);
                    }
                }

                medicalEntity.DoctorEntities.Remove(doctor);
            }
        }
コード例 #3
0
        public void Delete(PatientEntity item)
        {
            if (item == null)
            {
                return;
            }

            var treatmentRepository = TreatmentRepository.GetInstance();
            var patient             = medicalEntity.PatientEntities.FirstOrDefault(x => x.Id == item.Id);

            if (patient != null)
            {
                if (patient.Treatments != null && patient.Treatments.Any())
                {
                    while (patient.Treatments.Count > 0)
                    {
                        var treatment = patient.Treatments.LastOrDefault();
                        treatmentRepository.Delete(treatment);
                    }
                }

                medicalEntity.PatientEntities.Remove(patient);
            }
        }