Visual Studio created this code for me:
// GET: api/building/5
[ResponseType(typeof(building))]
public IHttpActionResult Getbuilding(int id)
{
building building = db.buildings.Find(id);
if (building == null)
{
return NotFound();
}
return Ok(building);
}
Each building can have a number images. Those images live in the table buildingimages
that looks like this:
| id | building_id | image |
------------------------------
| 0 | 76 | bob.jpg |
How can I load the related images along with the building, given the above code?
I've looked around, but none of the examples look exactly like my generated code. I suspect I'm just not using the right keywords and that the answer is blindingly simple.