public IActionResult UpdateTreatment(int id, [FromBody] UpdateTreatmentViewModel updateTreatment) { if (id != updateTreatment.Id) { return(BadRequest()); } if (!_service.Exist(id)) { return(NotFound()); } var treatmentDTO = TreatmentMapper.UpdateTreatmentVMToDTO(updateTreatment); _service.Update(treatmentDTO); return(NoContent()); }
public IActionResult CreateTreatmentHistory(int medicalChartId, [FromBody] CreateTreatmentHistoryViewModel createTreatmentHistory) { if (medicalChartId != createTreatmentHistory.MedicalChartId) { return(BadRequest()); } if ( !_medicalChartService.Exist(medicalChartId) || !_treatmentService.Exist(createTreatmentHistory.TreatmentId) || (createTreatmentHistory.UserId != null && !_dentistService.Exist(createTreatmentHistory.UserId)) ) { return(NotFound()); } var treatmentHistoryDTO = TreatmentHistoryMapper.CreateTreatmentHistoryVMToDTO(createTreatmentHistory); _treatmentHistoryService.Create(treatmentHistoryDTO); return(Ok(ModelState)); }