Cannot implicitly convert type 'System.Data.EntityState' to 'System.Data.Entity.EntityState'. An explicit conversion exists (are you missing a cast?)

前端 未结 3 1937
借酒劲吻你
借酒劲吻你 2020-12-15 20:51

I am getting this error in asp.net when using Entity Framework : \"Cannot implicitly convert type System.Data.EntityState to System.Data.Entity.EntityStat

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 21:36

    Your code must be like this:

    if (ModelState.IsValid)
    {
        db.Entry(movie).State = System.Data.Entity.EntityState.Modified;
        db.SaveChanges();
        return RedirectToAction("Index");
    }
    return View(movie);
    

提交回复
热议问题