private void UpdateDatabase(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                _dataService.AddCustomer((Customer)e.NewItems[0]);
                break;

            case NotifyCollectionChangedAction.Remove:
                _dataService.RemoveCustomer((Customer)e.OldItems[0]);
                break;

            case NotifyCollectionChangedAction.Replace:
                break;

            case NotifyCollectionChangedAction.Move:
                break;

            case NotifyCollectionChangedAction.Reset:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #2
0
        public Customer Add(Customer customer)
        {
            var added = _dataService.AddCustomer(customer);

            _allCustomers.Add(added);
            _allCustomers.Sort();
            return(added);
        }