public CsvGeneratorController(IGenerateCsvService service, IOptions <InputInvoice> inputInvoice, IOptions <OutputInvoice> outputInvoice) { Service = service; InputInvoice = inputInvoice; OutputInvoice = outputInvoice; }
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)); }