@page "/site-info/{SiteId:int}"
@attribute [Authorize]
@using BLAIzor.Components.Layout
@using BLAIzor.Models
@using BLAIzor.Services
@using Microsoft.AspNetCore.Components.Authorization
@layout AdminLayout
@inject ContentEditorService _contentEditorService
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject CustomAuthenticationStateProvider CustomAuthProvider
No forms added yet.
} Add New Form @code { [Parameter] public int SiteId { get; set; } private SiteInfo siteInfo = new(); private string? userId; private string? userName; private AuthenticationState? authState; protected override async Task OnParametersSetAsync() { authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); if (authState.User.Identity?.IsAuthenticated == true) { userId = CustomAuthProvider.GetUserId(); userName = CustomAuthProvider.GetUserName(); } siteInfo = await _contentEditorService.GetSiteInfoWithFormsByIdAsync(SiteId) ?? new SiteInfo(); } private async Task SaveSiteInfo() { await _contentEditorService.UpdateSiteInfoAsync(siteInfo); } }