/// <summary> /// Returns true if the specified customer exists in the /// repository, or false if it is not. /// </summary> public bool ContainsCustomer(FECustomer customer) { if (customer == null) throw new ArgumentNullException("customer"); return _customers.Contains(customer); }
public CustomerViewModel(FECustomer customer, CustomerRepository customerRepository) { if (customer == null) throw new ArgumentNullException("customer"); if (customerRepository == null) throw new ArgumentNullException("customerRepository"); _customer = customer; _customerRepository = customerRepository; }
/// <summary> /// Places the specified customer into the repository. /// If the customer is already in the repository, an /// exception is not thrown. /// </summary> public void AddCustomer(FECustomer customer) { if (customer == null) throw new ArgumentNullException("customer"); if (!_customers.Contains(customer)) { // TODO: Use static method client.addCustomer(new DBCustomer { Id = customer.Id, FirstName = customer.FirstName, LastName = customer.LastName, Curp = customer.Curp, Email = customer.Email} ); _customers.Add(customer); if (this.CustomerAdded != null) this.CustomerAdded(this, new CustomerAddedEventArgs(customer)); } }
void CreateNewCustomer() { FECustomer newCustomer = new FECustomer(); CustomerViewModel workspace = new CustomerViewModel(newCustomer, _customerRepository); this.Workspaces.Add(workspace); this.SetActiveWorkspace(workspace); }
public static DBCustomer FromFECustomer(FECustomer c) { return new DBCustomer { Id = c.Id, FirstName = c.FirstName, LastName = c.LastName, Email = c.Email, Curp = c.Curp }; }
public CustomerAddedEventArgs(FECustomer newCustomer) { this.NewCustomer = newCustomer; }