I have these two bits of code where I have a list highAmtCtrList which is a list that I get from ddr.Out.
It’s a list of contracts where you can have two records with the same contract number.
I use highAmtCtrList to get all first records only.
Then within a foreach, I check if the contracts in ddr.Dil match those of highAmtCtrList. If they do, I update the amount in highAmtCtrList with that of ddr.Dil.
The code I have works, it’s just that I’ve been trying to turn it into one bit of code and can’t seem to get around it.
Any ideas??
Tks in advance.
Rui Martins
List<Outstanding> highAmtCtrList =
(from d in ddr.Out
group d by d.Contract
into g
let highestInstallment =
(from x in g
orderby x.Amount descending
select x).First()
select highestInstallment).ToList();
highAmtCtrList.ForEach(outs => outs.Amount += ddr.Dil
.Where(dil => dil.Contract == outs.Contract)
.Select(dil => dil.Amount)
.FirstOrDefault());
}
I managed it on my own. I merged the two lists