摘要: dbContext private TestProductContext db = new TestProductContext();更新时候得需要去判断数据库纪录存不存在,那么[HttpPost] public ActionResult Edit(Product product) { if (ModelState.IsValid) { var model = (from p in db.Products where p.Id == product.Id select p).Count(); if (model > 0) { db.Entry(product).State = Entit 阅读全文
posted @ 2012-09-06 09:15 rayray2 阅读(361) 评论(0) 推荐(0) 编辑