How do you display list of data from two different table in a single view in MVC5 EF?
For example, I have two tables(Project/Proposer) and in Proposer
View I have Create
, Edit
and Details
pages. When user clicks on a Details
link the page displays the details for that proposer. But, how do I display list of project for that proposer?
This is my current ProposerController
:
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Proposer proposer = db.Proposers.Find(id);
var proposers = db.Proposers.ToList();
if (proposer == null)
{
return HttpNotFound();
}
return View(proposer);
}