public IActionResult GetSearchedPrescription(PrescriptionSearchDTO dto) { try { PrescriptionSearchValidator.Validate(dto); } catch (Exception e) { return(BadRequest(e.Message)); } List <Prescription> prescriptions = _prescriptionSearchService.GetSearchedPrescription(dto.Medicine, dto.HourlyIntake, dto.StartDate, dto.EndDate); List <PrescriptionDTO> prescriptionDTOs = PrescriptionMapper.ListPrescriptionToPrescriptionDTO(prescriptions); return(Ok(prescriptionDTOs)); }
public static void Validate(PrescriptionSearchDTO dto) { IsMedicineValid(dto.Medicine); IsHourlyIntakeValid(dto.HourlyIntake); }