/// <summary> /// This Deletes the Customer from the List and deactivates thew Customer, but the Customer is still in the Database. /// </summary> public void DeleteCustomer() { GlobalConfig.Connection.DeleteCustomer(SelectedCustomer); AvailableCustomers.Remove(SelectedCustomer); NotifyOfPropertyChange(() => AvailableCustomers); }
/// <summary> /// gets a Model from CreateNewCustomer and Adds this Model to the List in the ManageCustomerView /// and also Add the Customer to the Database /// </summary> /// <param name="customerModel"> /// This Param is a CustomerModel with all it needs to be saved in the Database /// </param> public void Handle(CustomerModel customerModel) { if (customerModel.FirstName == null) { LoadCreateCustomerIsVisible = false; LoadCustomerDetailsIsVisible = false; CustomerListIsVisible = true; SelectedCustomer = null; return; } if (!AvailableCustomers.Any(c => customerModel.Id == c.Id)) { AvailableCustomers.Add(customerModel); } LoadCreateCustomerIsVisible = false; LoadCustomerDetailsIsVisible = false; CustomerListIsVisible = true; SelectedCustomer = null; AvailableCustomers = new BindableCollection <CustomerModel>(GlobalConfig.Connection.Get_CustomerAll()); ActiveCustomer(AvailableCustomers); NotifyOfPropertyChange(() => AvailableCustomers); }