public void deleteCustomer(int id) { using (DataClassesOurCompanyDataContext db = new DataClassesOurCompanyDataContext()) { Customer customer = (from c in db.Customers where c.id == id select c).First(); db.Customers.DeleteOnSubmit(customer); db.SubmitChanges(); } }
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(); } }