Beispiel #1
0
 public static ToothDiseasesDTO CreateToothDiseasesVMToDTO(CreateToothDiseasesViewModel toothDiseases)
 {
     return(new ToothDiseasesDTO
     {
         ToothId = toothDiseases.ToothId,
         Diseases = toothDiseases.ToothDiseases.Select(d => DiseaseMapper.DiseaseVMtoDTO(d)).ToList(),
     });
 }
Beispiel #2
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));
        }