예제 #1
0
        public async Task <IActionResult> CreateStatistic([FromQuery] string year)
        {
            const string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            var          fileName    = $"Statistik_{year}.xlsx";

            await using var stream = new MemoryStream();

            var workbook = await _statisticRepository.CreateStatisticsOfYear(int.Parse(year));

            workbook.SaveAs(stream);
            var content = stream.ToArray();

            return(File(content, contentType, fileName));
        }