public List <DiseaseDTO> GetAll()
        {
            var diseases = _context.Diseases
                           .Select(d => DiseaseMapper.DiseaseToDTO(d))
                           .ToList();

            return(diseases);
        }
Esempio n. 2
0
        public List <DiseaseDTO> GetDiseases(int id)
        {
            var diseases = _context.Diseases
                           .Include(td => td.ToothDiseases)
                           .Where(td => td.ToothDiseases.Any(td => td.ToothId.Equals(id)))
                           .Select(d => DiseaseMapper.DiseaseToDTO(d))
                           .ToList();

            return(diseases);
        }
        public DiseaseDTO Get(int id)
        {
            var disease = _context.Diseases.SingleOrDefault(d => d.Id.Equals(id));

            if (disease is null)
            {
                return(null);
            }

            return(DiseaseMapper.DiseaseToDTO(disease));
        }