blob: e7298a91814648fd451b533c9547f669a8ae7711 (
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
32
33
34
35
36
37
|
using System.Text.Json;
using System.Text.RegularExpressions;
using Blog.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Mvc;
namespace Blog.Components.Pages;
public partial class BRP : ComponentBase
{
[Parameter]
public required string BSN { get; set; }
[Inject]
public required BrpService Service { get; set; }
private JsonDocument Entry { get; set; }
protected override async Task OnInitializedAsync()
{
Entry = await Service.GetBrpEntryAsync(BSN).ConfigureAwait(true);
await base.OnInitializedAsync();
}
internal static string Url(string bsn)
{
return $"/BRP/{bsn}";
}
internal static bool LooksLikeBSN(string value)
{
return BsnRegex().IsMatch(value);
}
[GeneratedRegex(@"^\d{8,9}$", RegexOptions.NonBacktracking)]
private static partial Regex BsnRegex();
}
|