continued to work on ThreadPage.razor
This commit is contained in:
parent
585440d10f
commit
4b1f234f2a
10 changed files with 327 additions and 17 deletions
|
@ -1,8 +0,0 @@
|
|||
@page "/{board}/thread/{threadId}"
|
||||
<h3>Thread #xx on /x/</h3>
|
||||
|
||||
@RouteData.Values["title"]
|
||||
|
||||
@code {
|
||||
|
||||
}
|
42
ImageBoardServerApp/Pages/ThreadPage.razor
Normal file
42
ImageBoardServerApp/Pages/ThreadPage.razor
Normal file
|
@ -0,0 +1,42 @@
|
|||
@page "/{boardName}/thread/{threadId}"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using ImageBoardServerApp.Data.Repository
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h3>Thread #@threadId on /@boardName/</h3>
|
||||
<Post post="@post" showOpenThread="false"/>
|
||||
<hr/>
|
||||
|
||||
@foreach (var comment in post.Comments)
|
||||
{
|
||||
<Comment comment="comment"/>
|
||||
<hr/>
|
||||
}
|
||||
<CommentForm post="post"/>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
[Required]
|
||||
public string boardName { get; set; }
|
||||
|
||||
[Parameter]
|
||||
[Required]
|
||||
public string threadId { get; set; }
|
||||
|
||||
private PostData post;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
post = await PostsRepository.getPostByIdAsync(int.Parse(threadId));
|
||||
}
|
||||
catch (FormatException fe)
|
||||
{
|
||||
NavigationManager.NavigateTo("/notfound");
|
||||
return;
|
||||
}
|
||||
if(post == null)
|
||||
NavigationManager.NavigateTo("/notfound");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue