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)); }
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)); }