using System.Collections.Generic;
public static void Main()
var data = new List<Location>()
LocationName = "First Location",
SaleTransactionList = new()
new() { SaleTransactionId = 1, Amount = 1500, LocationId = 1 },
new() { SaleTransactionId = 2, Amount = 700, LocationId = 1 },
new() { SaleTransactionId = 3, Amount = 2400, LocationId = 1 },
LocationName = "Second Location",
SaleTransactionList = new()
new() { SaleTransactionId = 1, Amount = 120000, LocationId = 1 },
new() { SaleTransactionId = 2, Amount = 700.99, LocationId = 1 },
new() { SaleTransactionId = 3, Amount = 2520.09, LocationId = 1 },
var q = data.Select(x => new result()
LocationId = x.LocationId,
LocationName = x.LocationName,
Revenues = x.SaleTransactionList.Sum(s => s.Amount)
Console.WriteLine($"Location: {x.LocationName} | Revenues: {x.Revenues}");
public int LocationId {get; set;}
public string LocationName {get; set;}
public List<SaleTransaction> SaleTransactionList {get; set;}
public class SaleTransaction
public int SaleTransactionId {get; set;}
public double Amount {get; set;}
public double LocationId {get; set;}
public int LocationId {get; set;}
public string LocationName {get; set;}
public double Revenues {get; set;}