Example #1
0
 public void Delete()
 {
     if (MessageBox.Show("Do you want to Delete this service?", "Confirm",
                         MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         _fieldedService.ServiceID = -_fieldedService.ServiceID;
         if (DataAccess.UpdateService(_fieldedService))
         {
             _sortedServices.Remove(_fieldedService);
             _sortedServices.Refresh();
             NotifyOfPropertyChange(() => CanDelete);
         }
     }
 }
Example #2
0
 public void Delete(bool FieldedCar_HasService)
 {
     if (MessageBox.Show("Do you want to Delete this car?", "Confirm",
                         MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         _fieldedCar.CarID = -_fieldedCar.CarID;
         try
         {
             DataAccess.UpdateCar(_fieldedCar);
         }
         catch (Exception e)
         {
             MessageBox.Show(
                 $"Database Error: {e.Message}");
             return;
         }
         if (_fieldedCar.CarID == 0)
         {
             _sortedCars.Remove(_fieldedCar);
             _sortedCars.Refresh();
         }
     }
 }