private void OnCommandAddAccount() { var newCustomerAccountWrapper = new CustomerBankAccountWrapper(new BankAccount()); newCustomerAccountWrapper.PropertyChanged += CustomerAccountWrapper_PropertyChanged; ListCustomerBankAccountWrapper.Add(newCustomerAccountWrapper); Customer.Entity.BankAccounts.Add(newCustomerAccountWrapper.Entity); //Trigger Validation newCustomerAccountWrapper.AccountNo = ""; }
private void InitializeListCustomerAccountWrapper(Customer customer) { foreach (var customerAccountWrapper in ListCustomerBankAccountWrapper) { customerAccountWrapper.PropertyChanged -= CustomerAccountWrapper_PropertyChanged; } ListCustomerBankAccountWrapper.Clear(); foreach (var customerBankAccount in customer.BankAccounts) { var customerAccountWrapper = new CustomerBankAccountWrapper(customerBankAccount); ListCustomerBankAccountWrapper.Add(customerAccountWrapper); customerAccountWrapper.PropertyChanged += CustomerAccountWrapper_PropertyChanged; } }
/// <summary> /// After user confirmation delete Bank Account Entity from Customer repository and list of Bank Accounts. Check if repositoryhas changes. /// </summary> private void OnCommandDeleteAccount() { var result = MessageDialogService.ShowOkCancelDialog($"Do you really want to delete the Bank Account ?", "Delete"); if (result == MessageDialogResult.OK) { SelectedBankAccount.PropertyChanged -= CustomerAccountWrapper_PropertyChanged; _repository.RemoveBankAccount(SelectedBankAccount.Entity); ListCustomerBankAccountWrapper.Remove(SelectedBankAccount); SelectedBankAccount = null; HasChanges = _repository.HasChanges(); //Lt. Video: //((DelegateCommand)CommandSave).RaiseCanExecuteChanged(); } }