Exemplo n.º 1
0
        public ActionResult ToCSV(string pRegion = null)
        {
            string  parameter = string.Empty;
            IOTools iO        = new IOTools();
            var     Reports   = new List <Data>();

            Reports = new CovidBL().GetReports(pRegion, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
            Reports = Reports.OrderByDescending(x => x.Confirmed).Take(10).ToList();
            var data = iO.CreateCSV(Reports);

            byte[] bytes  = System.Text.Encoding.UTF8.GetBytes(data);
            var    output = new FileContentResult(bytes, "application/octet-stream");

            output.FileDownloadName = "CovidCases.csv";

            return(output);
        }