예제 #1
0
 public int Creat(Product product)
 {
     dbContext.Products.Add(product);
     dbContext.SaveChanges();
     int index = 0;
     index = dbContext.Products.OrderBy(x => x.Name).ToList().IndexOf(product);
     return index;
 }
예제 #2
0
 public ActionResult UpdateProduct(Product product)
 {
     if (ModelState.IsValid)
     {
         dbContext.Entry(product).State = EntityState.Modified;
         dbContext.SaveChanges();
         return null;
     }
     else
     {
         return new HttpStatusCodeResult(400, "Custom Error Message 2");
     }
 }