Post post = db.posts.Find(Id)
在ASP.NET MVC中的含義是什麼?「Post post = db.posts.Find(Id)」是什麼意思在ASP.NET MVC中?
我收到「Posts」的錯誤:未定義。這裏是我的代碼:
public ActionResult ShowImage(int id)
{
VirtualSpeechTherapistEntities db = new VirtualSpeechTherapistEntities();
Post post = db.Posts.Find(id); // <- ERROR
LetterInfo letterInfo = new LetterInfo();
letterInfo.Letter_ID = post.Letter_ID;
letterInfo.Letter_Pic = post.image_url;
//set all other information you required
return View("TherapyLetter", letterInfo);
}
你會得到什麼錯誤? – WiiMaxx