Ejemplo n.º 1
0
        public async Task <ActionResult> DownloadMissingProducerDataCsv(int complianceYear,
                                                                        Guid?schemeId, ObligationType obligationType, int?quarter)
        {
            CSVFileData fileData;

            var request = new GetMissingProducerDataCsv(complianceYear, obligationType, quarter, schemeId);

            using (var client = apiClient())
            {
                fileData = await client.SendAsync(User.GetAccessToken(), request);
            }

            var data = new UTF8Encoding().GetBytes(fileData.FileContent);

            return(File(data, "text/csv", CsvFilenameFormat.FormatFileName(fileData.FileName)));
        }
        public async Task<ActionResult> DownloadMissingProducerDataCsv(int complianceYear,
            Guid? schemeId, ObligationType obligationType, int? quarter)
        {
            CSVFileData fileData;

            GetMissingProducerDataCsv request = new GetMissingProducerDataCsv(complianceYear, obligationType, quarter, schemeId);
            using (IWeeeClient client = apiClient())
            {
                fileData = await client.SendAsync(User.GetAccessToken(), request);
            }

            byte[] data = new UTF8Encoding().GetBytes(fileData.FileContent);
            return File(data, "text/csv", CsvFilenameFormat.FormatFileName(fileData.FileName));
        }