public IActionResult GetExaminations(int patientId) { try { if (!_patientInfoRepository.PatientExists(patientId)) { _logger.LogInformation("Patient not exist PatientID: " + patientId); return(NotFound()); } var exams = _patientInfoRepository.GetExaminations(patientId); if (exams == null) { _logger.LogInformation("Exams not found PatientID: " + patientId); return(NotFound()); } var examsDTOList = Mapper.Map <List <ExaminationsDTO> >(exams); return(Ok(examsDTOList)); } catch (Exception ex) { _logger.LogCritical("GetExaminations() Error: " + ex.Message.ToString()); return(StatusCode(500, "Internal Server Error")); } }