Asp.net mvc 4 在ASP.NET中删除信号失败
我想从表中删除raw 这是我的代码:Asp.net mvc 4 在ASP.NET中删除信号失败,asp.net-mvc-4,Asp.net Mvc 4,我想从表中删除raw 这是我的代码: [HttpGet] public ActionResult delete(int id) { var d = Ctx.createcourse.Where(x => x.CourseID == id).FirstOrDefault(); return View(d); } [HttpPost] public ActionResult delete(CreateCourse cou) { Ctx
[HttpGet]
public ActionResult delete(int id)
{
var d = Ctx.createcourse.Where(x => x.CourseID == id).FirstOrDefault();
return View(d);
}
[HttpPost]
public ActionResult delete(CreateCourse cou)
{
Ctx.Entry(cou).State = EntityState.Deleted;
Ctx.SaveChanges();
return View("courseview");
}
这就是错误:
System.Data.Entity.Infrastructure.DbUpdateConcurrencyException:'存储
update、insert或delete语句影响了意外数量的
行(0)。实体可能已被修改或删除,因为实体
都装了。寻找
关于理解和处理乐观并发的信息
例外情况