public List
{
using (Entities entities = new Entities())
{
var query = from group in entities.Groups
join team in entities.Teams on group.ID equals team.fkGroupID into team_outer from team in team_outer.DefaultIfEmpty()
where (group.ID == groupID || groupID == null)
&& (team.name.ToLower().Contains(name.ToLower()) || string.IsNullOrEmpty(name))
&& (team.Code.ToLower().Contains(code.ToLower()) || string.IsNullOrEmpty(code))
select group;
return query.ToList();
}
}
Search Amazon.com for Linq to Entity