public IActionResult GetSearchedReports(ReportSearchDTO dto) { try { ReportValidator.Validate(dto); } catch (Exception e) { return(BadRequest(e.Message)); } List <Report> reports = _reportSearchService.GetSearchedReports(dto.Doctor, dto.startDate, dto.endDate, dto.type); List <ReportDTO> reportDTOs = ReportMapper.ListExaminationSurgeryToReport(reports); return(Ok(reportDTOs)); }
public static void Validate(ReportSearchDTO dto) { IsNameValid(dto.Doctor); IsTypeValid(dto.type); }