I am doing a simple edit in ASP.NET MVC. The action result code is below. This example here
says I can do the following.
Code example:
public ActionResult Edit(int id)
{
using (var db = new BlogDataEntities())
{
return View(db.Blogs.Find(id));
}
}
But when I try to do it, I cannot get Find property for db.Amodel.?
What am I missing?
My code:
public ActionResult Edit(string id)
{
using (var db = new dbAEntities())
{
return View(db.Amodel.Find(id));//This is not working. Find is not
//recognzied and intellisense does
//not give me that option too.
}
}
They are referring to the Entity Framework 4.1 which seems to introduce the
Findmethod. You are probably using an older version. Rewrite the code to: