Esempio n. 1
0
        public ActionResult <TeethCategoryViewModel> GetTeeth(int medicalChartId)
        {
            if (!_medicalChartService.Exist(medicalChartId))
            {
                return(NotFound());
            }

            var medicalChart = _medicalChartService.GetTeeth(medicalChartId);

            return(ToothMapper.TeethCategoryDTOtoVM(medicalChart));
        }
        public TeethCategoryDTO GetTeeth(int medicalChartId)
        {
            var teethDTO = _context.Teeth
                           .Where(t => t.MedicalChartId.Equals(medicalChartId))
                           .Include(t => t.ToothDiseases)
                           .OrderBy(t => t.Order)
                           .Select(t => ToothMapper.ToothToDTO(t))
                           .ToList();

            return(ToothMapper.TeethToTeethCategoryDTO(teethDTO));
        }
Esempio n. 3
0
        public IActionResult CreateToothDiseases(int toothId, [FromBody] CreateToothDiseasesViewModel createToothDiseaseViewModel)
        {
            if (toothId != createToothDiseaseViewModel.ToothId)
            {
                return(BadRequest());
            }

            if (!_toothService.Exist(toothId))
            {
                return(NotFound());
            }

            var toothDiseasesDTO = ToothMapper.CreateToothDiseasesVMToDTO(createToothDiseaseViewModel);

            _toothService.CreateToothDiseases(toothDiseasesDTO);

            return(Ok(ModelState));
        }