I currently have the following code in the HomeController of my MVC project:
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);
}
Is there a way to have the view accept two models like this or, alternatively, a way to merge the two result sets (the two tables are not linked in any way?