apc-viewer/APC Viewer/Pages/TimePivot.cshtml.cs
2022-03-29 07:23:13 -07:00

49 lines
1.5 KiB
C#

using APCViewer.Models.Stateless.Methods;
using IFX.Shared;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Serilog.Context;
using Shared;
using System.Text.Json;
namespace APCViewer.Pages;
public class TimePivotPage : PageModel, Models.Properties.ITimePivotPage, ITimePivotPage
{
protected List<string[]> _ForIPDSF;
protected List<string[]> _ForPDSF;
public List<string[]> ForIPDSF => _ForIPDSF;
public List<string[]> ForPDSF => _ForPDSF;
private readonly Serilog.ILogger _Log;
private readonly Singleton.Background _Background;
private readonly Models.Methods.IBackground _BackgroundMethods;
#nullable disable
public TimePivotPage(Singleton.Background background)
{
_Background = background;
_BackgroundMethods = background;
_Log = Serilog.Log.ForContext<TimePivotPage>();
}
#nullable enable
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
public void OnGet(bool is_gaN = false, bool is_Si = false)
{
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{
_Log.Debug("() => ...");
Tuple<List<string[]>, List<string[]>> tuple = _BackgroundMethods.GetTimePivot(isGaN: is_gaN, isSi: is_Si);
_ForIPDSF = tuple.Item1;
_ForPDSF = tuple.Item2;
}
}
}