Ejemplo n.º 1
0
        public async Task <IActionResult> DownloadDataset(int datasetId)
        {
            var datatable = await _datasetService.ConsolidateDataset(datasetId);

            byte[] outputBuffer = null;

            using (MemoryStream tempStream = new MemoryStream())
            {
                using (StreamWriter writer = new StreamWriter(tempStream))
                {
                    IOhelper.WriteDataTable(datatable, writer, true);
                }

                outputBuffer = tempStream.ToArray();
            }
            //Response.Headers.Add("Content-Disposition", "inline; filename="+datatable.TableName + ".csv");
            return(File(outputBuffer, "text/csv", datatable.TableName + ".csv"));
        }