Getting error in MVC Proj while writing Lambda Expression

Posted by Shrewd Demon on Stack Overflow See other posts from Stack Overflow or by Shrewd Demon
Published on 2010-05-05T12:21:35Z Indexed on 2010/05/05 12:28 UTC
Read the original article Hit count: 269

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#