public ObservableCollection <ServiceTableField> ReloadServiceTableFieldList() { if (SelectedTable == null) { return(new ObservableCollection <ServiceTableField>()); } return(new ObservableCollection <ServiceTableField>(ServiceTableFieldDal.FindAll(x => x.TableID == SelectedTable.ID))); }
public void DeleteServiceTable(object param) { ServiceTable selectedServiceTable = (ServiceTable)((DataGrid)param).SelectedItem; if (ServiceTableFieldDal.FindAll().Exists(x => x.TableID == selectedServiceTable.ID)) { MessageBox.Show("A táblához tartozik mező, ezért nem törölhető!", "Hiba", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { MessageBoxResult messageBoxResult = MessageBox.Show("Valóban törli?", "Törlés megerősítése", MessageBoxButton.YesNo, MessageBoxImage.Question); if (messageBoxResult == MessageBoxResult.Yes) { ServiceTableList.Remove(selectedServiceTable); ServiceTableDal.LogicalDelete(selectedServiceTable); } ServiceTableList = ReloadServiceTableList(); } }