public static Customer Create(Customer newCustomer) { CustomerDataContext context = new CustomerDataContext(); context.Customers.InsertOnSubmit(newCustomer); context.SubmitChanges(); Customer cust = context.Customers.Single(c => c.CustomerID == newCustomer.CustomerID); return cust; }
public static void Update(Customer customer, string customerID) { CustomerDataContext context = new CustomerDataContext(); Customer cust = context.Customers.Single(c => c.CustomerID == customer.CustomerID); cust.CustomerID = customer.CustomerID; cust.Address = customer.Address; cust.City = customer.City; cust.CompanyName = customer.CompanyName; cust.ContactName = customer.ContactName; cust.ContactTitle = customer.ContactTitle; cust.Country = customer.Country; cust.Fax = customer.Fax; cust.Phone = customer.Phone; cust.PostalCode =customer.PostalCode; cust.Region = customer.Region; context.SubmitChanges(); }
partial void DeleteCustomer(Customer instance);
partial void UpdateCustomer(Customer instance);
partial void InsertCustomer(Customer instance);