45 lines
No EOL
1.1 KiB
Text
45 lines
No EOL
1.1 KiB
Text
@using System.ComponentModel.DataAnnotations
|
|
@using ImageBoardServerApp.Data.Repository
|
|
<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>
|
|
<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>
|
|
<span>@user.Role</span>
|
|
<br/>
|
|
|
|
@code {
|
|
private string selectedRole;
|
|
private bool edit = false;
|
|
|
|
[Parameter]
|
|
[Required]
|
|
public UserData user { get; set; }
|
|
|
|
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);
|
|
}
|
|
|
|
} |