예제 #1
0
 public ActionResult Edit(int id, ProductModel product)
 {
     if (ModelState.IsValid && id == product.ID)
     {
         db.Entry(product).State = System.Data.EntityState.Modified;
         db.SaveChanges();
     }
     return RedirectToAction("");
 }
예제 #2
0
 public ActionResult Create(ProductModel product)
 {
     if(ModelState.IsValid)
     {
         db.Products.Add(product);
         db.SaveChanges();
     }
     return RedirectToAction("");
 }