summaryrefslogtreecommitdiff
path: root/Blog/Components/Pages/BrpTestData.razor.cs
blob: 9d0fb35c3718537616806e7e294db4909deb15fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Blog.Models;
using Blog.Services;
using System.Linq;
using Microsoft.AspNetCore.Components;

namespace Blog.Components.Pages;

public partial class BrpTestData : ComponentBase, IDisposable
{
    public void Dispose()
    {
        CancellationTokenSource.Cancel();
        CancellationTokenSource.Dispose();
    }

    [Inject]
    public BrpService Service { get; set; }
    
    private CancellationTokenSource CancellationTokenSource { get; set; } = new CancellationTokenSource();
    
    protected override async Task OnInitializedAsync()
    {
        this.Entries = (await Service.GetBrpEntriesAsync(CancellationTokenSource.Token)
            .ConfigureAwait(true))
            .Where(entry => entry.bsn[0] != '1')
            .ToArray();
        await base.OnInitializedAsync();
    }

    private BRPEntry[] Entries { get; set; } = [];
}