public ObservableCollection <Prescription> GetAllPrescriptionsByPatient(string patientId) { if (prescriptions.blockChainClient.GetNumberOfConnectedPeers() >= 2) { ObservableCollection <Prescription> prescriptionsCollection = new ObservableCollection <Prescription>(); List <Block> blocks = prescriptions.GetAll(); foreach (Block block in blocks) { if (block.GetPrescription().patientId.Equals(patientId)) { prescriptionsCollection.Add(block.GetPrescription()); } } return(prescriptionsCollection); } else { TraceingManager.Message(LogMessages.LessThen2pearsMessage); return(null); } }