Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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");
     }
 }