我需要发送 2 个不同Models
的,一个到Index view
另一个到_Layout.cshtml
,我该怎么做?
我的HomeController
:
[Route("")]
public ActionResult Index()
{
HomeViewModel model = new HomeViewModel();
model.A = _repoA.GetLatest(4);
model.B = _repoB.GetLatest(4);
model.C = _repoC.GetLatest(4);
return View(model);
}
我不喜欢使用ViewBag
, ViewData
& ...,我正在寻找以与将模型传递给Views
.