0
我使用Code First所以它創建了實體和生成的數據集並使用LINQ來實現我的數據。我是新來的LINQ我想知道以下MVC3模型數據人口
這是我的一個表我的模型
namespace MISSanctions.Models
{
using System;
using System.Collections.Generic;
public partial class tbl_navigation_menus
{
public long tbl_nav_id { get; set; }
public string tbl_controller { get; set; }
public string tbl_method { get; set; }
public string tbl_menu_name { get; set; }
public long tbl_parent_id { get; set; }
public string tbl_view { get; set; }
public long tbl_child_id { get; set; }
public byte tbl_active { get; set; }
}
}
它與表的關係tbl_nav_rights
namespace MISSanctions.Models
{
using System;
using System.Collections.Generic;
public partial class tbl_nav_rights
{
public long tbl_nav_right_id { get; set; }
public long tbl_user_id { get; set; }
public long tbl_nav_id { get; set; }
public long tbl_nav_active { get; set; }
}
}
我要選擇的權利。的tbl_user_id是11796。意味着11769將擁有多個權利,我想通過上面的tbl_navigation_menus加入表格,其中包含導航名稱控制器名稱和方法以及一些圖標圖像。
我想創建一個單獨的模型,返回我的用戶ID 11769.我創造這樣一個模型的數據,但困惑如何在模型
這是主要的導航模型獲取多行這將返回到視圖
namespace MISSanctions.Models
{
public class AdminNavigationList
{
public int Userid {get;set;}
public int tbl_nav_id{get;set;}
public string tbl_controller { get; set; }
public string tbl_method { get; set; }
public string tbl_menu_name { get; set; }
public int tbl_parent_id { get; set; }
public bool active { get; set; }
public string tbl_icon { get; set; }
}
}
然後,我將通過顯示導航循環。請幫我實現它