Esempio n. 1
0
        public async Task <IViewComponentResult> InvokeAsync(
            ReportOptions options,
            ChartOptions chart)
        {
            if (options == null)
            {
                options = new ReportOptions();
            }

            if (chart == null)
            {
                chart = new ChartOptions();
            }


            var data = options.FeatureId > 0
                ? await _aggregatedEntityReplyRepository.SelectGroupedByDateAsync(
                "CreatedDate",
                options.Start,
                options.End,
                options.FeatureId)
                : await _aggregatedEntityReplyRepository.SelectGroupedByDateAsync(
                "CreatedDate",
                options.Start,
                options.End);

            return(View(new ChartViewModel <AggregatedResult <DateTimeOffset> >()
            {
                Options = chart,
                Data = data.MergeIntoRange(options.Start, options.End)
            }));
        }
Esempio n. 2
0
        public async Task <IViewComponentResult> InvokeAsync(
            ReportOptions options,
            ChartOptions chart)
        {
            if (options == null)
            {
                options = new ReportOptions();
            }

            if (chart == null)
            {
                chart = new ChartOptions();
            }

            var entities = options.FeatureId > 0
                ? await _aggregatedEntityRepository.SelectGroupedByDateAsync(
                "CreatedDate",
                options.Start,
                options.End,
                options.FeatureId)
                : await _aggregatedEntityRepository.SelectGroupedByDateAsync(
                "CreatedDate",
                options.Start,
                options.End);

            var replies = options.FeatureId > 0
                ? await _aggregatedEntityReplyRepository.SelectGroupedByDateAsync(
                "CreatedDate",
                options.Start,
                options.End,
                options.FeatureId)
                : await _aggregatedEntityReplyRepository.SelectGroupedByDateAsync(
                "CreatedDate",
                options.Start,
                options.End);


            var results = new Dictionary <string, ChartViewModel <AggregatedResult <DateTimeOffset> > >();

            results.Add("entities", new ChartViewModel <AggregatedResult <DateTimeOffset> >()
            {
                Options = chart,
                Data    = entities.MergeIntoRange(options.Start, options.End)
            });
            results.Add("replies", new ChartViewModel <AggregatedResult <DateTimeOffset> >()
            {
                Options = chart,
                Data    = replies.MergeIntoRange(options.Start, options.End)
            });

            return(View(results));
        }