I'm trying to get a summary of confirmed / completed purchases by querying the SalesConfirmation table, but I am having difficulty parsing the method.
Database Table
Here is the table for the SalesConfirmation table in which completed sales are stored.
Id OfferId ProdId Qty SaleDate
-------------------------------------------------------
10 7 121518 150 2013-03-14 00:00:00.000
19 7 100518 35 2013-03-18 14:46:34.287
20 7 121518 805 2013-03-19 13:03:34.023
21 10 131541 10 2013-03-20 08:34:40.287
- Id: unique identifier for the string.
- OfferId: a foreign key that refers to the offer / sale table.
- ProdId: product identifier in the product table.
- Qty: quantity sold to customer.
- SaleDate: date of sale completion.
Controller action
var confRollUps = db.SaleConfirmation
.GroupBy(c => c.OfferId)
.Select(g => g.Select(i => new {
i.OfferId,
i.Product.Variety,
i.Offer.Price,
i.Offer.Quantity,
i.Offer.DateClose,
g.Sum(ii => ii.Qty)
}));
There is an error in the g.Sum selection request (ii => ii.Qty) , and an error below.
. , .