I am trying to perform to calculation. I have a donations (d) table that contains Quantity Needed (d.QtyNeeded) and I need to determine the numbers of items still needed by pulling quantity filled (qtyfilled) from the donors table. Not every donation has a donor, so I need a conditional statement to handle nulls so the sum will work. When I try to compile, I am getting an error: *Operator '-' cannot be applied to operands of type 'int' and 'bool'. I am not great at Linq yet, what am I missing or is there a better way?
QtyOpen = d.QtyNeeded - (from dv in db.Donors
select dv).All(v => v.QtyFilled == null)
? 0
: (from dv in db.Donations
select dv.QtyFilled).Sum()