public async Task <IEnumerable <NotificationTypesCount> > Handle(GetNotificationTypesCount request, CancellationToken cancellationToken) { var notifications = GetQuery(); var groupedTypes = notifications .GroupBy(g => new { g.IntegrationEventType }) .Select(s => new { s.Key.IntegrationEventType, Count = s.Count() }); var eventTypes = groupedTypes.Select(x => new NotificationTypesCount { EventType = x.IntegrationEventType, Count = x.Count }); await Task.CompletedTask; return(eventTypes); }
public async Task <IActionResult> GetEventTypesCount([FromQuery] GetNotificationTypesCount query) { var statistics = await _mediator.Send(query); return(Ok(statistics)); }