Beispiel #1
0
        public async Task <string> SeedNews()
        {
            if (!_webHostEnvironment.IsDevelopment())
            {
                return("");
            }

            var pathBase = Path.GetFullPath($@"{Directory.GetCurrentDirectory()}\..\TestData\FinwireFiles");


            foreach (var dir in Directory.GetDirectories(pathBase).ToList())
            {
                foreach (var file in Directory.GetFiles(dir))
                {
                    var finwireData = _finwireParserService.ParseFile(file);
                    await _finwireNewsService.AddSingleNews(finwireData.Result);
                }
            }
            return("OK");
        }
Beispiel #2
0
        public void Execute()
        {
            var pathBase = Path.GetFullPath($@"{Directory.GetCurrentDirectory()}\..\TestData\FinwireFiles");

            for (int i = 1; i <= 8; i++)
            {
                //there is no data
                if (i == 4 || i == 5)
                {
                    continue;
                }

                var path = $@"{pathBase}\{i.ToString("D2")}";

                foreach (var file in Directory.GetFiles(path))
                {
                    var finwireData = _parser.ParseFile(file);
                    _finwireNewsService.AddSingleNews(finwireData.Result);
                }
            }
        }