我试图在asp net 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" ) }
我在哪里犯错?
您需要实例化该类并使用该对象:
public ActionResult IndexTrEn()
{
var tm = new trenMethod();
tm.ListAll();
...
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句