public Task <List <DataChartResponse> > Handle(GetTicketsTypeChartQuery request, CancellationToken cancellationToken) { try { var tickets = _dbContext.Tickets.ToList(); var featureTickets = tickets.Where(t => t.Type.Equals(TicketType.Feature)).Count(); var userStoryTickets = tickets.Where(t => t.Type.Equals(TicketType.UserStory)).Count(); var taskTickets = tickets.Where(t => t.Type.Equals(TicketType.Task)).Count(); return(Task.FromResult(new List <DataChartResponse> { new DataChartResponse { Name = TicketType.Feature, Value = featureTickets }, new DataChartResponse { Name = TicketType.UserStory, Value = userStoryTickets }, new DataChartResponse { Name = TicketType.Task, Value = taskTickets } })); } catch (Exception ex) { throw new Exception("There was an error getting the tickets with type field for chart", ex); } }
public async Task <IActionResult> GetTicketsType([FromQuery] GetTicketsTypeChartQuery ticket) { var result = await Mediator.Send(ticket); return(Ok(result)); }