public async Task <IActionResult> Get(int patientId, [FromQuery] string search = null) { //if logged in user is a DR, get all prescritpions for this doctor //else if user is a patient, get all prescriptions for this patient if (await _clinicRepository.GetPatientPrescriptionsAsync(patientId) is IEnumerable <Prescription> prescriptions) { return(Ok(prescriptions)); } else { return(NotFound()); } }
public async Task <IActionResult> GetPresctiptions([FromRoute] int id) { // check if the patient with that id exists //if they exist, check authorization of the user //probably then forward this request to the reports controller if (await _clinicRepository.GetPatientPrescriptionsAsync(id) is IEnumerable <Prescription> prescriptions) { return(Ok(prescriptions)); } else { return(NotFound()); } }