private void buttonAdd_Click(object sender, RoutedEventArgs e) { EditWindow editWindow = new EditWindow(); if (editWindow.ShowDialog() == (Nullable <bool>)true) { database.AddCocktailToDatabase(editWindow.GetCocktail()); ReloadData(); } }
private void buttonEdit_Click(object sender, RoutedEventArgs e) { if (listCocktails.SelectedItems.Count != 0) { EditWindow editWindow = new EditWindow( ((Cocktail)((ListBoxItem)listCocktails.Items[listCocktails.SelectedIndex]).Tag)); if (editWindow.ShowDialog() == (Nullable <bool>)true) { database.UpdateCocktailToDatabase(editWindow.GetCocktail()); ReloadData(); } } }