public List <Medicine> GetMedicines(bool withPrescription) { Console.WriteLine("Dostępne leki:"); var allMedicines = medicineRepository.LoadAllFromDB(); var result = new List <Medicine>(); foreach (Medicine medicine in allMedicines) { if (medicine.WithPrescription == withPrescription) { result.Add(medicine); Console.WriteLine("\t" + medicine.ToString()); } } Console.WriteLine("Koniec listy leków ============================================"); return(result); }