score:2

Accepted answer

Try below code

            var summaryPayments = (from s in paymentsList
                               join alloc in allocationList on s.ID equals alloc.OriginalID into allocOrg
                               from po in allocOrg.DefaultIfEmpty()
                               join allocRev in allocationList on s.ID equals allocRev.ReversalID into allocRevs
                               from pr in allocRevs.DefaultIfEmpty()
                               select new { s, pr }).Select(x => { x.s.ReversalId = (x.pr != null ? x.pr.ReversalID : 0); return x.s; });

Related Articles