bulletboards/ImageBoardServerApp/Pages/Moderation/BoardManagementPage.razor

45 lines
No EOL
1.3 KiB
Text

@page "/sys/modmenu/boards"
@using ImageBoardServerApp.Data.Repository
<AuthorizeView Roles="Admin">
<Authorized>
<h3>Boards</h3>
<span>Tag / Topic / Max Threads / GETs / Locked?</span>
<br/>
<hr/>
@foreach (var b in brds)
{
<a href="/@b.Tag">@b.Tag</a>
<span> / @b.Topic / @b.maxThreads / @b.NumberOfGETs / @b.isLocked / </span>
<a href="/sys/modmenu/boards/edit/@b.Tag">Edit Board</a>
<span> / </span>
<a @onclick="() => removeBoard(b)" href="javascript:void(0)">Delete Board</a>
<br/>
<hr/>
}
<BoardForm/>
</Authorized>
<NotAuthorized>
<DeadLink/>
</NotAuthorized>
</AuthorizeView>
@code {
public List<BoardData> brds { get; set; }
protected override async Task OnParametersSetAsync()
{
await base.OnParametersSetAsync();
brds = await BoardsRepository.getBoardsAsync();
}
private async Task removeBoard(BoardData b)
{
List<PostData> postsOnB = await PostsRepository.getPostsByBoardAsync(b.Tag);
foreach (var p in postsOnB)
{
await TheManager.deleteThread(p);
}
await BoardsRepository.deleteBoardAsync(b.BoardID);
}
}