Example #1
0
 private void Delete()
 {
     svcCustomer.CustomerServiceClient c = new svcCustomer.CustomerServiceClient();
     c.DeleteCustomer(this.CustomerId);
     //refresh the view
     this.Container.CustomerList = this.Container.GetCustomers();
 }
Example #2
0
 private void Update()
 {
     svcCustomer.CustomerServiceClient c = new svcCustomer.CustomerServiceClient();
     if (this.Mode == ViewModel.Mode.Add)  //if adding a customer
     {
         c.AddCustomer(this.FirstName, this.LastName);
         //refresh the view
         this.Container.CustomerList = this.Container.GetCustomers();
     }
     else if (this.Mode == ViewModel.Mode.Edit)  //if editing a customer
     {
         c.UpdateCustomer(new svcCustomer.Customer
         {
             CustomerId = this.CustomerId,
             FirstName  = this.FirstName,
             LastName   = this.LastName
         });
         //copy the current value so in case cancel you can undo
         this.originalValue = (CustomerViewModel)this.MemberwiseClone();
     }
 }