Untitled

 avatar
unknown
plain_text
a year ago
538 B
5
Indexable
public async Task<IEnumerable<Vaciadototal>> GetLastPeriod(string clientId, int count)
{
    var query = from v in _context.Vaciadototals
                where v.Numcliente.Trim() == clientId
                group v by v.Numcliente into g
                select new
                {
                    ClientId = g.Key,
                    LastPeriods = g.OrderByDescending(k => k.Periodo).Take(count)
                };

    var results = await query.SelectMany(g => g.LastPeriods).ToListAsync();

    return results;
}
Editor is loading...