2023-02-12 18:06:33 +00:00
|
|
|
@using System.ComponentModel.DataAnnotations
|
2023-02-13 21:34:30 +00:00
|
|
|
@using ImageBoardServerApp.Data.Repository
|
2023-06-14 15:24:51 +00:00
|
|
|
@inject NavigationManager navManager
|
2023-02-12 18:06:33 +00:00
|
|
|
<span>@user.Email | </span>
|
|
|
|
<span>@user.Posts.Count Posts | </span>
|
|
|
|
<span>@user.Comments.Count Comments | </span>
|
|
|
|
<span>@user.SubmittedReports.Count Reports submitted | </span>
|
|
|
|
<span>@user.RecivedReports.Count Reports recived | </span>
|
2023-02-13 21:34:30 +00:00
|
|
|
<span> </span>
|
|
|
|
<select name="role" id="role" @bind="@selectedRole">
|
|
|
|
<option value="User">User</option>
|
|
|
|
<option value="Mod">Mod</option>
|
|
|
|
<option value="Admin">Admin</option>
|
|
|
|
</select>
|
2023-06-13 15:43:52 +00:00
|
|
|
<a onclick="@updateRole()" href="javascript:void(0)">Update Role</a>
|
2023-06-13 17:08:43 +00:00
|
|
|
<span> </span>
|
2023-06-13 15:43:52 +00:00
|
|
|
<a onclick="@unban()" href="javascript:void(0)">Unban (if banned)</a>
|
2023-02-13 21:34:30 +00:00
|
|
|
<span> </span>
|
2023-02-12 18:06:33 +00:00
|
|
|
<span>@user.Role</span>
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
@code {
|
2023-02-13 21:34:30 +00:00
|
|
|
private string selectedRole;
|
2023-02-12 18:06:33 +00:00
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
[Required]
|
|
|
|
public UserData user { get; set; }
|
|
|
|
|
2023-02-13 21:34:30 +00:00
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
|
|
|
selectedRole = user.Role;
|
|
|
|
}
|
|
|
|
|
2023-06-13 15:43:52 +00:00
|
|
|
private async Task unban()
|
|
|
|
{
|
|
|
|
user.BanReason = "Not Banned";
|
|
|
|
user.TimeBanned = -1;
|
|
|
|
await UsersRepository.updateUserAsync(user);
|
|
|
|
}
|
|
|
|
|
2023-02-13 21:34:30 +00:00
|
|
|
private async Task updateRole()
|
|
|
|
{
|
|
|
|
user.Role = selectedRole;
|
|
|
|
await UsersRepository.updateUserAsync(user);
|
|
|
|
}
|
|
|
|
|
2023-02-12 18:06:33 +00:00
|
|
|
}
|