这是我的控制器代码,我在其中添加了脚本运行的详细信息并将其传递给我的视图。如何在我的视图中访问它并将其转换为字典中的表格形式?我尝试了几件事,但看起来并不乐观,所以我没有发布代码以供查看。任何通用解决方案都可以。
public ActionResult tab()
{
//Febuary runs
ScriptRun run1 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-1));
ScriptRun run2 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-1));
//January runs
ScriptRun run3 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-2));
ScriptRun run4 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-2));
//
ScriptRun run5 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-1));
ScriptRun run6 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-1));
ScriptRun run7 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-1));
ScriptRun run8 = new ScriptRun("IE","Tech2",DateTime.Now.AddMonths(-1));
List<ScriptRun> janRuns = new List<ScriptRun>();
janRuns.Add(run3);
janRuns.Add(run4);
Dictionary<string,List<ScriptRun>> runs = new Dictionary<string,List<ScriptRun>>();
runs.Add("Jan",janRuns);
return View(runs);
}