I'm new to asp.net & I'm trying to make a website with asp.net mvc 4 & EF6 where I need two models to work under the same view. I've tried a lot but couldn't figure out how to make that work. Here are my codes,
Controller
public ActionResult AfterLogin()
{
if (Session["UserNAME"] != null)
{
var firstmodel = new MyViewModel { stats = db.stats.ToList() };
var secondmodel = new MyViewModel { mans = db.mans.ToList() };
return View(firstmodel); //How can I also add the "secondmodel"?
}
else
{
return RedirectToAction("Login");
}
}
Model
public class MyViewModel
{
public IEnumerable<stat> stats { get; set; }
public IEnumerable<man> mans { get; set; }
}
How can I use both model at the same time? Need this help badly. Tnx.