private void deleteButton_Click(object sender, RoutedEventArgs e) { if (fuelGrid.SelectedItems.Count > 0) { for (int i = 0; i < fuelGrid.SelectedItems.Count; i++) { FUEL fuel = fuelGrid.SelectedItems[i] as FUEL; if (fuel != null) { db.fuels.Remove(fuel); } } } db.SaveChanges(); }
private void chooseButton_Click(object sender, RoutedEventArgs e) { if (fuelGrid.SelectedItems.Count != 0) { for (int i = 0; i < fuelGrid.SelectedItems.Count; i++) { FUEL fuel = fuelGrid.SelectedItems[i] as FUEL; if (fuel != null) { FN = fuel.FuelName; Price = fuel.FuelPrice; } } } QuantityWindow QW = new QuantityWindow(FN, Price, UserName); QW.ShowDialog(); }