@page "/{boardName}/thread/{threadId}"
@using System.ComponentModel.DataAnnotations
@using ImageBoardServerApp.Data.Repository
@inject NavigationManager NavigationManager
Thread #@post.GET on /@boardName/ - BulletBoard
Thread #@post.GET on /@boardName/
@foreach (var comment in post.Comments)
{
}
@code {
[Parameter]
[Required]
public string boardName { get; set; }
[Parameter]
[Required]
public string threadId { get; set; }
private PostData post;
protected override async Task OnInitializedAsync()
{
if (!int.TryParse(threadId, out _))
NavigationManager.NavigateTo("/notfound");
post = await PostsRepository.getPostByIdAsync(int.Parse(threadId));
if (post == null)
NavigationManager.NavigateTo("/notfound");
if (post.Board != boardName)
NavigationManager.NavigateTo("/notfound");
if (post == null)
NavigationManager.NavigateTo("/notfound");
}
}