Getting error in MVC Proj while writing Lambda Expression
- by Shrewd Demon
hi,
i am creating a sample movie (MVC) application. I was getting fine with Viewing and Creating a new record, but when i wrote the code to get the details of a particular record i met with the following error:
Unable to cast objec`t of type 'System.Data.Objects.ObjectQuery`1[MovieApp.Models.Movie]' to type 'MovieApp.Model`s.Movie'.
here is the code i wrote for getting the details
public ActionResult Details(int id)
{
var moviedetail = (Movie)_entities.MovieSet.Where(mvid => mvid.Id == id);
return View(moviedetail);
}
can any body tell me whats going wrong and where ??
thank you.