예제 #1
0
        public void RemoveRentalEmpty()
        {
            Rental rentalEmpty = Rentals.FirstOrDefault(r => r.Items.Count() <= 0 && r.RentalDate != null);

            if (rentalEmpty != null)
            {
                Rentals.Remove(rentalEmpty);
                SaveChanges();
            }
        }
예제 #2
0
파일: RentForm.cs 프로젝트: shimakee/BVS
        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();
            }
        }
예제 #4
0
 public void RemoveRental(Rental rental)
 {
     Rentals.Remove(rental);
     SaveChanges();
 }