Ejemplo n.º 1
0
        public void DeleteById(string id)
        {
            Case c = caseFactory.create(caseRepository.findByIdAsync(id).Result);

            requestorRepository.DeleteById(c.RequestorId);
            patientRepository.DeleteById(c.PatientId);

            foreach (string sID in c.Specimens)
            {
                List <string> slidesIds = specimenFactory.create(specimenRepository.findByIdAsync(sID).Result).Slides;

                if (slidesIds != null && slidesIds.Count > 0)
                {
                    List <Slide> slides = slideRepository.ListAsync(slidesIds).Result;
                    foreach (Slide s in slides)
                    {
                        slideRepository.DeleteById(s.Id);
                    }
                }

                specimenRepository.DeleteById(sID);
            }

            caseRepository.DeleteById(id);
        }