I have a page that displays a list of contracts. Each line contains the amount, fee and total amount that I calculate the line of this line.
I am also trying to calculate the total amount that sums Total from the collection.
Here is what I have:
var contracts = _contractsRepository.Contracts. Select(c => new ContractViewModel { ContractId = c.ContractID, Amount = c.Amount, Fee = c.Fee, Total = c.Sum(cc => cc.Amount) + c.Sum(cc => cc.AdminFee) });
I get a compilation error when I try to calculate the total amount, which says:
Member 'string.Format (string, params object [])' cannot be obtained with reference to the instance; qualify it instead of type name
Does anyone know what I can do to fix this?
source share