public Task <Response> Handle(Request request, CancellationToken cancellationToken) { var dashboard = _eventStore.Query <Dashboard>(request.DashboardId); var dashboardCards = new List <DashboardCardDto>(); foreach (var dashboardCardId in dashboard.DashboardCardIds) { dashboardCards.Add(DashboardCardDto.FromDashboardCard(_eventStore.Query <DashboardCard>(dashboardCardId))); } return(Task.FromResult(new Response() { Dashboard = DashboardDto.FromDashboard(dashboard, dashboardCards) })); }
public Task <Response> Handle(Request request, CancellationToken cancellationToken) { var dashboard = _eventStore.Query <Dashboard>("Name", "Default"); var dashboardDto = DashboardDto.FromDashboard(dashboard); var dashboardCardDtos = new List <DashboardCardDto>(); foreach (var dashboardCardId in dashboard.DashboardCardIds) { var dashboardCardDto = DashboardCardDto.FromDashboardCard(_eventStore.Query <DashboardCard>(dashboardCardId)); dashboardCardDto.Card = CardDto.FromCard(_eventStore.Query <Card>(dashboardCardDto.CardId)); dashboardCardDtos.Add(dashboardCardDto); } return(Task.FromResult(new Response() { Dashboard = DashboardDto.FromDashboard(dashboard, dashboardCardDtos) })); }
public Task <Response> Handle(Request request, CancellationToken cancellationToken) => Task.FromResult(new Response() { Dashboards = _eventStore.Query <Dashboard>().Select(x => DashboardDto.FromDashboard(x)).ToList() });