This is the working sql I need converted to Linq:
select * from dbo.Pod p
left join dbo.PodEvent pe on p.PodId = pe.Pod_PodId
left join dbo.Event e on pe.Event_EventId = e.EventId
where e.StartDateTime >= '2014-12-24 09:00:00.000'
and e.EndDateTime <= '2014-12-24 14:30:00.000'
I have been trying suggestions from different posts all day and this is the best I could do and the issue is that its an inner join, where I need it to be a left join so I can get all the pods for given time interval:
List<Pod> pods =
(from p in db.Pods
join pe in db.PodEvents on p.PodId equals pe.Pod.PodId
join e in db.Events on pe.Event.EventId equals e.EventId
where
e.StartDateTime == userInfo.StartDateTime
&&
e.EndDateTime <= userInfo.EndDateTime
select p).ToList();
Thanks