Exemplo n.º 1
0
        public async Task <ActionResult> Download(EstablishmentType type)
        {
            List <ChartViewModel> benchmarkCharts;
            string csv = null;

            if (type == EstablishmentType.MAT)
            {
                benchmarkCharts = BuildTrustBenchmarkCharts(RevenueGroupType.AllExcludingSchoolPerf, ChartGroupType.All, UnitType.AbsoluteMoney, MatFinancingType.TrustAndAcademies);
                csv             = _csvBuilder.BuildCSVContentForTrusts(base.ExtractTrustComparisonListFromCookie(), benchmarkCharts);
            }
            else
            {
                benchmarkCharts = await BuildSchoolBenchmarkChartsAsync(RevenueGroupType.AllIncludingSchoolPerf, ChartGroupType.All, null, CentralFinancingType.Exclude);

                csv = _csvBuilder.BuildCSVContentForSchools(base.ExtractSchoolComparisonListFromCookie(), benchmarkCharts);
            }

            return(File(Encoding.UTF8.GetBytes(csv),
                        "text/plain",
                        "BenchmarkData.csv"));
        }