public List <Prescription> GetPrescriptionsForPatient(int patientID) { List <Prescription> prescriptionsForPatient = new List <Prescription>(); foreach (Prescription prescription in prescriptionRepository.GetAllEntities().ToList()) { if (prescription.MedicalExamination.PatientId == patientID) { prescriptionsForPatient.Add(prescription); } } return(prescriptionsForPatient); }