Models內容
public class MyViewModel {
public List<table1> TheFirstTable {get;set;}
public List<table2> TheSecondTable {get;set;}
}
Controller內容
MyViewModel viewModel = new MyViewModel();
viewModel.TheFirstTable = //first table content
viewModel.TheSecondTable = //second table content
return View(viewmodel);
View內容
//多筆資料
@foreach(var row in Model.TheFirstTable) {
//do something with the row
}
//單筆資料
@Model.TheSecondTable
這樣就能同時輸出多筆不同的 List 嘍!