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-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
|
|
|
<a onclick="@editF()" href="javascript:void(0)">Edit</a>
|
|
|
|
<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>
|
|
|
|
<a onclick="@updateRole()" href="javascript:void(0)" >Update Role</a>
|
|
|
|
<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;
|
|
|
|
private bool edit = false;
|
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()
|
|
|
|
{
|
|
|
|
edit = false;
|
|
|
|
selectedRole = user.Role;
|
|
|
|
}
|
|
|
|
|
|
|
|
private async Task editF()
|
|
|
|
{
|
|
|
|
edit = !edit;
|
|
|
|
}
|
|
|
|
|
|
|
|
private async Task updateRole()
|
|
|
|
{
|
|
|
|
user.Role = selectedRole;
|
|
|
|
await UsersRepository.updateUserAsync(user);
|
|
|
|
}
|
|
|
|
|
2023-02-12 18:06:33 +00:00
|
|
|
}
|