private void FillConclusionList() { using (var context = new MedicalClinicContext()) { List <Conclusion> conclusions = context.Conclusion.Where(conc => conc.MedcardId == patient.MedcardId).ToList(); foreach (var conclusion in conclusions) { string nameSurname = $"{conclusion.Appointment.Doctor.PersonalData.Surname} {conclusion.Appointment.Doctor.PersonalData.Name}"; string speciality = conclusion.Appointment.Doctor.Speciality.Name; DateTime date = conclusion.Appointment.DateTimeOfMeeting; ElemOfList elem = new ElemOfList(conclusion.Id, nameSurname, speciality, date); Conclusions.Items.Add(elem); } } }
private void ConclusionClick(object sender, SelectionChangedEventArgs e) { if (Conclusions.SelectedValue == null) { return; } var lv = sender as ListView; ElemOfList elem = lv.SelectedItem as ElemOfList; int appointmentId; using (var context = new MedicalClinicContext()) { appointmentId = context.Conclusion.FirstOrDefault(conc => conc.Id == elem.ConclusionId).AppointmentId; } new ConclusionResultWindow(appointmentId).ShowDialog(); Conclusions.SelectedItem = null; }