コード例 #1
0
ファイル: QLCustomerController.cs プロジェクト: hieuly93/SVN
 public int Creat(Customer customer)
 {
     dbContext.Customers.Add(customer);
     dbContext.SaveChanges();
     int index = 0;
     index = dbContext.Customers.OrderBy(x => x.Name).ToList().IndexOf(customer);
     return index;
 }
コード例 #2
0
ファイル: QLCustomerController.cs プロジェクト: hieuly93/SVN
 public ActionResult UpdateCustomer(Customer customer)
 {
     if (ModelState.IsValid)
     {
         dbContext.Entry(customer).State = EntityState.Modified;
         dbContext.SaveChanges();
         return null;
     }
     else
     {
         return new HttpStatusCodeResult(400, "Custom Error Message 2");
     }
 }