我目前在我的MVC项目主计长办公室有以下代码:
public class HomeController : Controller
{
public ActionResult Index()
{
MyDataContext dc = new MyDataContext();
IQueryable<Table1Data> j =
from n in dc.Table1
select n;
return View(j);
}
So that works okay, but now I want to pass a second table through to the same view. So I was thinking I should be able to do something like this:
public class HomeController : Controller
{
public ActionResult Index()
{
MyDataContext dc = new MyDataContext();
IQueryable<Table1Data> j =
from n in dc.Table1
select n;
IQueryable<Table2Data> l =
from k in dc.Table2
select k;
return View(j, l);
}
是否有办法让这种观点接受两种模式,或者,或者说是合并两种结果组合的办法(两个表格没有任何关联?)