0
我試圖在asp網絡mvc中學習一些東西。如何在asp網絡控制器中使用自定義方法mvc
我無法處理問題。
我有一個像
public class trenMethod
{
public testDBContex db;
public List<IsSoSu> ListAll()
{
var Name= from a in db.test1
from b in db.test2
where a.Name== b.Name
select new IsSoSu()
{
NameLast=a.Name,
MidNameLast=a.MidName,
SurnameLast=b.Surname
};
return Name.ToList();
}
它沒關係與自定義類。但是當我想在控制器中使用這種方法時,該方法似乎並沒有。
public ActionResult IndexTrEn()
{
trenMethod. <there is nothing in here> (i expect that trenMethod.ListAll(); but there is nothing except "Equals, ReferenceEquals") }
我在哪裏犯錯?
請注意,模型 - 視圖 - 控制器標記是關於模式的問題。 ASP.NET-MVC實現有一個特定的標籤。 –
這裏沒有什麼,因爲你的'ListAll'方法不是靜態的,你試圖把它稱爲它。 –