StreamReader citanje iz lokalnog fajla

PHOTO EMBED

Tue Oct 04 2022 07:16:21 GMT+0000 (Coordinated Universal Time)

Saved by @necamat #c#

using Microsoft.AspNetCore.Hosting;

public async Task<NESTO?> GetKiaDealerInfoAsync()
        {
            string location = _webHostEnvironment.WebRootPath;
            string fileName = "PUTANJA";
            string filePath = Path.Combine(location, fileName);

            using (StreamReader streamReader = new(filePath))
            {
                string json = await streamReader.ReadToEndAsync();
                return JsonSerializer.Deserialize<NESTO>(json);
            }
        }
content_copyCOPY