using System.Text.Json; using System.Text.RegularExpressions; using Blog.Services; using Microsoft.AspNetCore.Components; 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 RequestBody { get; set; } private JsonDocument Entry { get; set; } protected override async Task OnInitializedAsync() { (RequestBody, 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(); }