public partial class ChucNang
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public ChucNang()
{
this.Chuc_Nang_Quan_Tri = new HashSet<Chuc_Nang_Quan_Tri>();
}
public int ID { get; set; }
public string Ten { get; set; }
public Nullable<System.DateTime> NgayTao { get; set; }
public Nullable<bool> TrangThai { get; set; }
public string DuongDan { get; set; }
public string Icon { get; set; }
public string Token { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Chuc_Nang_Quan_Tri> Chuc_Nang_Quan_Tri { get; set; }
}
public partial class Chuc_Nang_Quan_Tri
{
public int ID { get; set; }
public Nullable<System.DateTime> NgayTao { get; set; }
public int MaChucNang { get; set; }
public int MaQuanTri { get; set; }
public virtual List<ChucNang> ChucNang { get; set; }
public virtual List<QuanTri> QuanTri { get; set; }
}
public ActionResult ShowMenu ()
{
if(Session["ID"] != null && Session["Ten"] != null && Session["User"] != null)
{
int id = (int)Session["ID"];
var user = db.Chuc_Nang_Quan_Tri.Join(db.ChucNangs, x => x.MaChucNang, y => y.ID, (x, y) => new { x, y }).Where(q => q.x.MaQuanTri == id).ToList();
ViewBag.user = user;
return PartialView("_menu_right");
}
return RedirectToAction("Logout");
}
请帮助我解决问题。 将2个ChucNagQuanTri和DanhChuc表连接在一起后,我需要从DanhMuc表中检索列表。
我正在学习asp.net mvc。请让我知道该错误以及如何解决该错误以便我改善。 谢谢大家