Ok I now have this
public IEnumerable<roomvu_User> GetLocationUsers(
long LocationID,
DateTime StartDate,
DateTime EndDate,
int StartRows,
int MaximumRows)
{
using ( DataClasses_RoomViewDataContext context = Context )
{
IEnumerable<roomvu_LocationMapping> Mappings =
( from m in context.roomvu_LocationMappings
where ( m.LocationID == LocationID
&& ( StartDate <= m.EndDate && m.StartDate <= EndDate ) )
select m ).Skip( StartRows ).Take( MaximumRows );
List<roomvu_User> Users = new List<roomvu_User>();
foreach ( roomvu_LocationMapping Mapping in Mappings )
{
roomvu_User User = ( from u in context.roomvu_Users
where ( u.ID == Mapping.UserID )
select u ).Single();
Users.Add( User );
}
return Users;
}
}
But I hate the foreach bit, there must be a way to do this in a single LINQ expression.....
Help