I believe this should be done in the DocumentController. Below is an example
public class DocumentController : ApiController {
public IQueryable<Document> GetDocs()
{
//get db context
return db.documents;
}
public ICollection<Document> Get(int id)
{
return db.documents.where(d = d.ProjectId == id);
}
}
The IQuerable version can be queried using odata filter query. like below:
http://server:port/api/Document/getdocs?$filter=ProjectId eq ‘1'
http://server:port/api/Document/getdocs?$filter=DocumentId eq ‘1001'
(you will have to modify the MapHttpRoute to register this route)
The get version (second function) will simply return collection based on the project id.