Пример #1
0
            public Task <Response> Handle(Request request, CancellationToken cancellationToken)
            {
                var dashboard    = _repository.Query <Dashboard>(request.DashboardId);
                var dashboardDto = DashboardDto.FromDashboard(dashboard);

                dashboardDto.DashboardCards = _repository
                                              .Query <DashboardCard>(dashboard.DashboardCardIds)
                                              .Select(x => DashboardCardDto.FromDashboardCard(x)).ToList();

                return(Task.FromResult(new Response()
                {
                    Dashboard = dashboardDto
                }));
            }
Пример #2
0
            public Task <Response> Handle(Request request, CancellationToken cancellationToken)
            {
                var dashboards = _repository.Query <Dashboard>().ToList();

                var dashboard = _repository.Query <Dashboard>()
                                .Single(x => x.Name == "Default" && x.UserId == request.CurrentUserId);

                var dashboardDto = DashboardDto.FromDashboard(dashboard);

                var dashboardCardDtos = new List <DashboardCardDto>();

                foreach (var dashboardCardId in dashboard.DashboardCardIds)
                {
                    var dashboardCardDto = DashboardCardDto.FromDashboardCard(_repository.Query <DashboardCard>(dashboardCardId));
                    dashboardCardDto.Card = CardDto.FromCard(_repository.Query <Card>(dashboardCardDto.CardId));
                    dashboardCardDtos.Add(dashboardCardDto);
                }

                return(Task.FromResult(new Response()
                {
                    Dashboard = DashboardDto.FromDashboard(dashboard, dashboardCardDtos)
                }));
            }
Пример #3
0
 public Task <Response> Handle(Request request, CancellationToken cancellationToken)
 => Task.FromResult(new Response()
 {
     Dashboards = _repository.Query <Dashboard>().Select(x => DashboardDto.FromDashboard(x)).ToList()
 });