示例#1
0
 public CsvGeneratorController(IGenerateCsvService service,
                               IOptions <InputInvoice> inputInvoice,
                               IOptions <OutputInvoice> outputInvoice)
 {
     Service       = service;
     InputInvoice  = inputInvoice;
     OutputInvoice = outputInvoice;
 }
示例#2
0
        public async Task <IActionResult> GenerateCsv(int id, int rows, [FromServices] IGenerateCsvService csvService)
        {
            var schemaId   = id;
            var rowsNumber = rows;
            int dataSetId;

            try
            {
                dataSetId = await csvService.GenerateData(schemaId, rowsNumber);
            }
            catch (Exception e)
            {
                logger.LogError("Error while generating csv file {0}", e);
                return(RedirectToAction("Index", new { id = id, generationError = true }));
            }


            var dataSet = dataService.GetDatasetById(dataSetId);

            var result = dataSet.Name;

            return(Content(result));
        }