public IActionResult GetIndexStatistics(GetIndexStatisticsRequest request)
        {
            GetIndexStatisticsResponse result = new GetIndexStatisticsResponse();

            if (request != null && request.Filter != null)
            {
                HandleException(() =>
                {
                    var data = new IndexStatisticsData();
                    var totalIndexStatsRepository          = DALRepositories.GetTotalIndexStatisticsRepository();
                    var statementIndexStatisticsRepository = DALRepositories.GetNormalizedStatementIndexStatisticsRepository();
                    data.TotalIndexStatistics            = totalIndexStatsRepository.GetAllForIndex(request.IndexID, request.Filter.DateFrom, request.Filter.DateTo).ToList();
                    data.IndexSummaryStatementStatistics = statementIndexStatisticsRepository.GetIndexSummaryStatementStatistics(request.IndexID, request.Filter.DateFrom, request.Filter.DateTo).ToList();
                    result.Data      = data;
                    result.IsSuccess = result.Data != null;
                }, ex => result.ErrorMessage = ex.Message);
            }
            return(Json(result));
        }
        public IActionResult GetStatementStatistics(GetStatementStatisticsRequest request)
        {
            GetStatementStatisticsResponse result = new GetStatementStatisticsResponse();

            if (request != null && request.Filter != null)
            {
                HandleException(() =>
                {
                    var data = new StatementStatisticsData();
                    var totalStatsRepository         = DALRepositories.GetNormalizedStatementStatisticsRepository();
                    var relationStatsRepository      = DALRepositories.GetNormalizedStatementRelationStatisticsRepository();
                    var indexStatsRepository         = DALRepositories.GetNormalizedStatementIndexStatisticsRepository();
                    data.StatementTimeline           = totalStatsRepository.GetTimelineForStatement(request.StatementID, request.Filter.DateFrom, request.Filter.DateTo).ToList();
                    data.StatementRelationStatistics = relationStatsRepository.GetAllForStatement(request.StatementID, request.Filter.DateFrom, request.Filter.DateTo).ToList();
                    data.StatementIndexStatistics    = indexStatsRepository.GetAllForStatement(request.StatementID, request.Filter.DateFrom, request.Filter.DateTo).ToList();
                    data.SlowestRepresentatives      = totalStatsRepository.GetSlowestForStatement(request.StatementID, request.Filter.DateFrom, request.Filter.DateTo, 10).ToList();
                    result.Data      = data;
                    result.IsSuccess = result.Data != null;
                }, ex => result.ErrorMessage = ex.Message);
            }
            return(Json(result));
        }