Пример #1
0
        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();

            }
        }
Пример #2
0
 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();
     }
 }
Пример #3
0
 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();
     }
 }