我想使用实体框架数据库第一种方法在单个视图中显示多个表的记录。
这是我的控制器类:
public ActionResult Index()
{
var query = (from c in db.tblBlogs
join d in db.tblBlogComments on c.id equals d.BlogId
join e in
db.tblBlogLikes on c.id equals e.BlogId
join f in db.tblBlogMedias on c.id equals f.BlogId
where c.id == d.BlogId || c.id == e.BlogId || c.id ==
f.BlogId
select c).OrderByDescending(d =>
d.id).ToList().Take(6);
return View(query);
}
如何在单个视图中显示多个表中的这些记录?
先谢谢。