diff --git a/UsageWatcher/Model/UsageModel.cs b/UsageWatcher/Model/UsageModel.cs index afa12c9..f50d1aa 100644 --- a/UsageWatcher/Model/UsageModel.cs +++ b/UsageWatcher/Model/UsageModel.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using UsageWatcher.Enums; namespace UsageWatcher.Model @@ -14,5 +15,14 @@ public UsageModel(Resolution resolution, DateTime startTime) StartTime = startTime; EndTime = startTime + TimeSpan.FromMilliseconds((double)resolution); } + + [JsonConstructor] + [System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", + "IDE0051:Remove unused private members", Justification = "Only for Json it is used")] + private UsageModel(DateTime startTime, DateTime endTime) + { + StartTime = startTime; + EndTime = endTime; + } } }