public IActionResult ReadCsv() { var filePath = $"{Environment.CurrentDirectory}/CSVFile"; // Created directory const string file = "report.csv"; var productList = _csvHelper.ReadCsv($"{filePath}/{file}", new ProductCsvMap())?.ToList(); if (productList == null || productList.Count == 0) { _logger.LogWarning("CSV empty"); return StatusCode(500, "CSV empty"); } var product = _mapper.Map<List<Product>, List<ProductDto>>(productList); return Ok(product); }