public ActionResult Studentdshboard()
{
using (ApplicationDbContext context = new ApplicationDbContext())
{
var currentUserId = User.Identity.GetUserId();
List<SelectListItem> list = new List<SelectListItem>();
var StdInfo = (from r in context.Users
where r.Id == currentUserId
join s in context.Students on r.Id equals s.Id
join d in context.Departments on s.DepartmentId equals d.Id
join c in context.Classes on s.ClassId equals c.Id
join sec in context.Sections on s.SectionId equals sec.Id
select new
{
r.Name,
d.DepartmentName,
c.ClassName,
sec.SectionName
});
return View(StdInfo.ToList());
}
}
这是我的UsersDashboardController
动作;如何在视图中显示上方列表