All but DataTable Deserialize
This commit is contained in:
30
Client/Pages/AwaitingDisposition.razor.cs
Normal file
30
Client/Pages/AwaitingDisposition.razor.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
namespace OI.Metrology.Client.Pages;
|
||||
|
||||
public partial class AwaitingDisposition
|
||||
{
|
||||
|
||||
[Inject] protected HttpClient? HttpClient { get; set; }
|
||||
[Inject] protected ILogger<AwaitingDisposition>? Logger { get; set; }
|
||||
|
||||
private Metrology.Shared.DataModels.AwaitingDisposition[]? _Records;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Logger is null)
|
||||
throw new NullReferenceException(nameof(Logger));
|
||||
if (HttpClient is null)
|
||||
throw new NullReferenceException(nameof(HttpClient));
|
||||
string controllerName = IAwaitingDispoController<object>.GetRouteName();
|
||||
try
|
||||
{ _Records = await HttpClient.GetFromJsonAsync<Metrology.Shared.DataModels.AwaitingDisposition[]>($"api/{controllerName}"); }
|
||||
catch (Exception)
|
||||
{
|
||||
string json = await HttpClient.GetStringAsync($"api/{controllerName}");
|
||||
Logger.LogInformation(message: json);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user