I have the following information
var details = Details.Where(d => d.isActive);
I would like to query another table, Authorizations
, that has a FK to Details
, and get the sum amounts of the authorizations that are contained within the details
object grouped by the detail
and a FundCode
.
Details (1 to many) Authorizations
Seems simple enough, however I'm having a bit of trouble.
Here is what I currently have:
var account = (from sumOfAuths in Authorizations
where details.Contains(sumOfAuths.Details)
&& sumOfAuths.RequestStatusId == 2
group sumOfAuths by new { sumOfAuths.Detail, sumOfAuths.FundCode } into child
select new {
....
Amount = child.Amount
}).Sum()
The problem is that inside the .Sum()
function I have collection of objects rather than 1. So I can't Sum the amounts properly.