Consider the following code:
Controller:
public ActionResult ShowMenu ()
{
if(Session["ID"] != null && Session["Ten"] != null && Session["User"] != null)
{
int id = (int)Session["ID"];
ViewBag.user= db.ChucNangs.Join(db.Chuc_Nang_Quan_Tris, x => x.ID, y => y.MaChucNang, (x, y) => new {Ten = x.Ten, DuongDan = x.DuongDan,Icon= x.Icon, TrangThai = x.TrangThai }).Where(x=>x.TrangThai == true).ToList();
return PartialView("_menu_right");
}
return RedirectToAction("Logout");
}
I have an object of type Anonymous, and although there is data, it still displays an error.
How can I prevent this error?