Exemple #1
0
        public async Task <ObjectResult> PostCsvAsync([FromBody] string csv)
        {
            _logger.LogDebug($"PostCsvAsync({csv}");
            var result = Enumerable.Empty <OutputRowModel>();

            using (var stream = csv.ToStream())
            {
                result = CsvHelperProxy.ReadRowsFromStream(stream).ToResult(_mapper).ToList();
            }
            return(Ok(result));
        }
Exemple #2
0
        public async Task <ObjectResult> GetCsvAsync([FromQuery, Required] string csvUri)
        {
            _logger.LogDebug($"GetCsvAsync({csvUri}");
            var response = await ServiceHttpClient.GetAsync(csvUri);

            var result = Enumerable.Empty <OutputRowModel>();

            using (var stream = await response.Content.ReadAsStreamAsync())
            {
                result = CsvHelperProxy.ReadRowsFromStream(stream).ToResult(_mapper).ToList();
            }
            return(Ok(result));
        }