Hello, I have created 2 queries that yield the same results, one is not very readable but is shorter:
var ppls = db.ProjectMembers
.Where(f => f.Project.ProjectStatusSet.Status == "Active" && f.IsContact == true)
.Select(z => z.Person).GroupBy(p => p.Id)
.Select(grp => grp.FirstOrDefault())
.OrderBy(t => t.Name)
.ToList();and the other is readable but longer:
var ppls =
(from ppl in db.People
join pm in db.ProjectMembers
on ppl.Id equals pm.ProjectMember_Person
join p in db.Projects
on pm.ProjectMember_Project equals p.Id
join pss in db.ProjectStatusSets
on p.Project_ProjectStatus equals pss.Id
where pss.Status == "Active" && pm.IsContact == true
select ppl
).GroupBy(p => p.Id).Select(grp => grp.FirstOrDefault()).OrderBy(t => t.Name).ToList();How can I make this readable and concise?