score:2

First part of your question:

var projectIDs = db.ProjectMembers.Where(c=> c.UserID=u.UserID).select(pm=>pm.ProjectID) ;

2nd part:

if you are using Entity Framework, you should see a property called (project) for every entity of your ProjectMembers list, you can simply ignore my first part of this answer and go directly with this one

var projectsList = db.ProjectMembers.Where(c=> c.UserID=u.UserID).select(pm=>pm.Project) ;

the property may have a different name, give it a try and let me know what happened.

note: that if the retrieved projects were null, then your Entity framework is working wth Eager loading (Google it). so in order to let the Entity framework generate the proper SQL syntax to retrieve the projects data, add an Include() to your query as the following:

var projectsList = db.ProjectMembers.Where(c=> c.UserID=u.UserID).Include("Projects").select(pm=>pm.Project) ;

Related Articles