@using ImageBoardServerApp.Data.Repository
@inject NavigationManager navigationManager
@code {
[Parameter]
public string Tag { get; set; }
[Parameter]
public string Topic { get; set; }
[Parameter]
public string maxThread { get; set; }
[Parameter]
public bool lockBoard { get; set; }
private async Task onPostClick()
{
if (!int.TryParse(maxThread, out _))
return;
var newB = new BoardData()
{
Tag = Tag.ToLower(),
Topic = Topic,
maxThreads = int.Parse(maxThread),
isLocked = lockBoard,
NumberOfGETs = 0
};
var bCheck = await BoardsRepository.getBoardByTagAsync(newB.Tag);
if (bCheck == null)
{
await BoardsRepository.createBoardAsync(newB);
return;
}
bCheck.Tag = newB.Tag;
bCheck.Topic = newB.Topic;
bCheck.maxThreads = newB.maxThreads;
bCheck.isLocked = newB.isLocked;
await BoardsRepository.updateBoardAsync(bCheck);
navigationManager.NavigateTo("/sys/modmenu/boards", true, true);
}
}