//Metoda usuwająca element z bazy private void DeleteButtonClick(object sender, RoutedEventArgs e) { if (TabsComboBox.SelectedIndex == 0) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz usunąć?", "Alert", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { int index = AppointmentTab.AppointmentIndex; AppointmentRepo.DeleteAppointment(Lists.Appointments[index].ID_wizyty.ToString()); TableSpace.Children.Clear(); TableSpace.Children.Add(new AppointmentTab(1)); } } else if (TabsComboBox.SelectedIndex == 1) { MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz usunąć?", "Alert", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { int index = PatientTab.PatientIndex; if (DeletePeselCheck(Lists.Patients[index].PESEL) == true) { MessageBox.Show("Nie można usunąć pacjenta z wizytami!"); } else { PatientRepo.DeletePatient(Lists.Patients[index].PESEL); TableSpace.Children.Clear(); TableSpace.Children.Add(new PatientTab()); } } } }
public ActionResult DeletePatient([FromQuery] string Dni) { //Check if patient exists var patientFromRepo = _repository.GetPatientByDniRaw(Dni); if (patientFromRepo == null) { return(NotFound()); } _repository.DeletePatient(Dni); return(NoContent()); }