private void addBuildingType(object sender, RoutedEventArgs e) { var bType = new BuildingType(); AddEditBuildingTypeWindow addEditBuildingTypeWindow = new AddEditBuildingTypeWindow(bType); var result = addEditBuildingTypeWindow.ShowDialog(); if (result == true) { context.BuildingTypes.Add(bType); buildingTypes.Add(bType); context.Save(); addEditBuildingTypeWindow.Close(); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { var bType = viewBuildingTypeDataGrid.SelectedItem as BuildingType; if (bType != null) { AddEditBuildingTypeWindow addEditBuildingTypeWindow = new AddEditBuildingTypeWindow(bType); var result = addEditBuildingTypeWindow.ShowDialog(); if (result == true) { this.DialogResult = true; context.Save(); addEditBuildingTypeWindow.Close(); } else { viewBuildingTypeDataGrid.DataContext = null; viewBuildingTypeDataGrid.DataContext = buildingTypes; } } }