public Customer getById(int id) { Customer customer = new Customer(); using (DataClassesOurCompanyDataContext db = new DataClassesOurCompanyDataContext()) { customer = (from c in db.Customers where c.id == id select c).First(); } return customer; }
public void editCustomer(Customer c) { using (DataClassesOurCompanyDataContext db = new DataClassesOurCompanyDataContext()) { var q = (from cust in db.Customers where cust.id == c.id select cust).First(); q.Name = c.Name; q.Address = c.Address; q.TelephoneNo = c.TelephoneNo; q.EmailAddress = c.EmailAddress; db.SubmitChanges(); } }
public void create(Customer c) { using (DataClassesOurCompanyDataContext db = new DataClassesOurCompanyDataContext()) { Customer cust = new Customer(); cust.Name = c.Name; cust.Address = c.Address; cust.TelephoneNo = c.TelephoneNo; cust.EmailAddress = c.EmailAddress; db.Customers.InsertOnSubmit(cust); db.SubmitChanges(); } }
partial void DeleteCustomer(Customer instance);
partial void UpdateCustomer(Customer instance);
partial void InsertCustomer(Customer instance);