private void yesBtn_Click(object sender, RoutedEventArgs e) { if (patient != null) { examinationController.DeletePatientExaminations(patient.Jmbg); patientCardController.DeletePatientCard(patient.Jmbg); userController.DeleteProfile(patient.Jmbg); therapyController.DeletePatientTherapies(patient.Jmbg); placementInSickRoomController.DeletePatientPlacements(patient.Jmbg); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(MainWindow)) { (window as MainWindow).Main.Content = new PatientView(); } } this.Close(); } }