コード例 #1
0
ファイル: CustomerModel.cs プロジェクト: gronel/MVC5-tutorial
 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;
 }
コード例 #2
0
ファイル: CustomerModel.cs プロジェクト: gronel/MVC5-tutorial
 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
ファイル: CustomerModel.cs プロジェクト: gronel/MVC5-tutorial
 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();
     }
 }
コード例 #4
0
 partial void DeleteCustomer(Customer instance);
コード例 #5
0
 partial void UpdateCustomer(Customer instance);
コード例 #6
0
 partial void InsertCustomer(Customer instance);