WebApi - linq widok z encją

0

Hej,
robię coś takiego

IEnumerable<Transaction> transactions = _salesService.GetTransactions(dto);

teraz w taki sposób operuje na transactions sumując i grupując wybrane wartości

            var list = transactions
                .GroupBy(x => (x.SalesRepresentativeId))
                .Select(x => new 
                {
                    Net = x.Sum(y => y.Net), 
                    Quantity = x.Sum(y => y.Quantity), 
                    PaymentLeft = x.Sum(y => y.PaymentLeft), 
                    SaleRepresentativeId = x.Key 
                })
                .OrderByDescending(x => x.Acronym)
                .ToList();

teraz chciałbym do tej listy dodać użytkownika po SaleRepresentativeId.
Jak to zrobić User jest encją ( tabela w bazie) ...
_salesService.GetTransactions pod spodem to Dapper pobierający dane z widoku.

w tej chwili list

    {
        "net": 1407774.66,
        "quantity": 829.4500,
        "paymentLeft": 11702.22,
        "saleRepresentativeId": 189,
        "email": "[email protected]", // dodać
        "name": "John"           // dodać 
    },
1

Zmień model Transaction, w zapytaniu SQL dodaj JOIN do tabeli z SaleRepresentatives i wyciągnij te kolumny.

1 użytkowników online, w tym zalogowanych: 0, gości: 1