public void RemoveRentalEmpty() { Rental rentalEmpty = Rentals.FirstOrDefault(r => r.Items.Count() <= 0 && r.RentalDate != null); if (rentalEmpty != null) { Rentals.Remove(rentalEmpty); SaveChanges(); } }
private void remove_Click(object sender, EventArgs e) { if (Rentals.Contains(VideoSelected)) { Rentals.Remove(VideoSelected); } rentalList.DataSource = Rentals; totalAmount.DataBindings.Clear(); totalAmount.DataBindings.Add("Text", this, nameof(this.totalAmount)); }
private void BtnRentalDelete_Click(object sender, RoutedEventArgs e) { Button deleteButton = (Button)sender; Rental rental = (Rental)deleteButton.DataContext; MessageBoxResult result = MessageBox.Show( "Ben je zeker dat je deze huurovereenkomst wil verwijderen?", "Huurovereenkomst verwijderen?", MessageBoxButton.YesNo, MessageBoxImage.Question ); if (result == MessageBoxResult.Yes) { rentals.Remove(rental); UpdateRentals(); } }
public void RemoveRental(Rental rental) { Rentals.Remove(rental); SaveChanges(); }