Exemplo n.º 1
0
        // Deletes the specified customer
        public void deleteCustomer(int customerId)
        {
            CustomerModel.deleteCustomer(customerId);

            CustomerModel deletedCustomer = CustomerList.Where(cust => cust.customerId == customerId).First();

            // Remove from the specified customer from the customer list
            CustomerList.Remove(deletedCustomer);
            // Also remove from the original customer list
            originalCustomerList.Remove(deletedCustomer);

            // Add to the deleted customer list
            DeletedCustomerList.Add(deletedCustomer);
        }
Exemplo n.º 2
0
        // Restores a customer back
        public void restoreCustomer(int customerId)
        {
            // Changes the customer status back to active
            CustomerModel.restoreCustomer(customerId);
            // Get the model of the restored customer
            CustomerModel restoredCustomer = DeletedCustomerList.Where(cust => cust.customerId == customerId).First();

            // Add the model to the active customer list
            CustomerList.Add(restoredCustomer);
            originalCustomerList.Add(restoredCustomer);

            // Remove from the deleted customer list
            DeletedCustomerList.Remove(restoredCustomer);

            // Re-filter the customers
            filterCustomers();
        }