Files
CartriX/CartriX.Web/Pages/PrintersPage.razor
T

37 lines
1.3 KiB
Plaintext

@page "/Printers"
@using CartriX.Shared.DTOs.Location
@using CartriX.Shared.DTOs.Printer
<RadzenDataGrid Data="locations">
<Columns>
<RadzenDataGridColumn Title="Расположения" Property="@nameof(QueryToListLocationsAndPrintersDto.name)" Resizable="true"/>
</Columns>
<Template Context="location">
<RadzenDataGrid Data="location.printers">
<Columns>
<RadzenDataGridColumn title="Название принтера" Property="name"/>
<RadzenDataGridColumn title="Hostname" Property="hostname"/>
<RadzenDataGridColumn title="IP адрес" Property="ipAddress"/>
<RadzenDataGridColumn title="Модель" Property="modelName" />
</Columns>
</RadzenDataGrid>
</Template>
</RadzenDataGrid>
@code {
List<QueryToListLocationsAndPrintersDto> locations = null!;
protected override async Task OnParametersSetAsync()
{
await base.OnParametersSetAsync();
HttpClient client = new();
var response = await client.GetAsync("http://localhost:5197/api/Location/GetAll");
locations = JsonConvert.DeserializeObject<List<QueryToListLocationsAndPrintersDto>>(await response.Content.ReadAsStringAsync())!;
}
}