public async Task <ActionResult> GetAsync(IFormFile file, [FromServices] IExcelConverterService service) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (file == null) { return(BadRequest(new string[] { "There is no file in 'file' parameter in body." })); } string temporaryFilePath = Path.GetTempFileName(); if (file.Length > 0) { using (FileStream stream = new FileStream(temporaryFilePath, FileMode.Create)) { await file.CopyToAsync(stream); return(Ok(service.ConvertExcelToDictionary(stream))); } } return(BadRequest(new string[] { "The provided file is zero-byte length." })); }
public DataController(INasaService nasaService, IExcelConverterService excelConverter) { this.nasaService = nasaService; this.excelConverter = excelConverter; }
public HomeController(INasaService nasaService, IExcelConverterService excelConverter, IMapper mapper) { this.nasaService = nasaService; this.excelConverter = excelConverter; this.mapper = mapper; }