public ActionResult EditPro(Product pro) { entity.Entry(pro).State = EntityState.Modified; if (entity.SaveChanges() > 0) { return(RedirectToAction("Index")); } else { return(Content("<script>alert('修改失败')</script>")); } }
//修改商品 public ActionResult UpdateProduct(Product pro) { PEntity.Entry <Product>(pro).State = System.Data.Entity.EntityState.Modified; PEntity.SaveChanges(); return(RedirectToAction("Index")); }