You should create a view model as follows:
public class FooViewModel
{
public IEnumerable<LinkModel> Links { get; set; }
public IEnumerable<AboutModel> Abouts { get; set; }
public IEnumerable<PortfolioModel> Portfolios { get; set; }
public IEnumerable<SkillModel> Skills { get; set; }
}
Then from your controller populate them as to your requirements, as an example:
public ActionResult Index()
{
var model = new FooViewModel();
model.Links = db.Links.ToList();
model.Abouts = db.Abouts.ToList();
model.Portfolios = db.Portfolios.ToList();
model.Skills = db.Skills.ToList();
return View(model);
}
Then change the model in your view to FooViewModel
and all your properties will be available in there.
@model FooViewModel
<ul>
@foreach (var item in Model.Links)
{
<li>
@item
</li>
}
</ul>
<ul>
@foreach (var item in Model.Links)
{
<li>
@item
</li>
}
</ul>
// ....etc, obviously change the outputs as needed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…