I have a page with a list of devices. Every device has a detail page. What i'm trying to achieve is get a list of all projects belonging to a device on the device detail page. A device can have several projects, and a project can also be linked to several devices (many-to-many relation). I have a table in my database to link the device and project tables in order to achieve the many-to-many relation. I'm using active record to communicate with my database.
The code for my detail page looks like this:
public ActionResult Details(int id)
{
ViewData["Id"] = id;
return View(Device.Find(id));
}
My question is: How do I send the list of projects to the device detail view aswell?