Fixed missing buttons for deletion

This commit is contained in:
2024-05-05 18:20:50 +02:00
parent 04f7e998cb
commit a3f6121eda
5 changed files with 35 additions and 7 deletions

View File

@@ -16,10 +16,16 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
public Customer SelectedCustomer
{
get { return selectedCustomer; }
set { SetProperty(ref selectedCustomer, value); (UpdateCustomerCommand as RelayCommand).NotifyCanExecuteChanged(); }
set
{
SetProperty(ref selectedCustomer, value);
(UpdateCustomerCommand as RelayCommand).NotifyCanExecuteChanged();
(DeleteCustomerCommand as RelayCommand).NotifyCanExecuteChanged();
}
}
public ICommand UpdateCustomerCommand { get; set; }
public ICommand DeleteCustomerCommand { get; set; }
public static bool IsInDesignMode
{
@@ -44,6 +50,15 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
{
return SelectedCustomer != null;
});
DeleteCustomerCommand = new RelayCommand(() =>
{
Customers.Delete(SelectedCustomer.ID);
},
() =>
{
return SelectedCustomer != null;
});
}
}
}