Added backend API project to segregate responsibilites - Data is now handled in API project and business is all handled in UI project.
This commit is contained in:
19
ReportingServices.Shared/HelperClasses/JsonFileHandler.cs
Normal file
19
ReportingServices.Shared/HelperClasses/JsonFileHandler.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ReportingServices.Shared.HelperClasses
|
||||
{
|
||||
public static class JsonFileHandler
|
||||
{
|
||||
public static T LoadJSONFile<T>(string file)
|
||||
{
|
||||
string json = File.ReadAllText(file);
|
||||
return JsonSerializer.Deserialize<T>(json);
|
||||
}
|
||||
|
||||
public static void SaveJSONFile<T>(T obj, string file)
|
||||
{
|
||||
string json = JsonSerializer.Serialize(obj);
|
||||
File.WriteAllText(file, json);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user