Change users page layout
This commit is contained in:
@ -33,7 +33,7 @@
|
||||
<RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false">
|
||||
@errorMessage
|
||||
</RadzenAlert>
|
||||
<RadzenDataGrid TItem="AppUserWithRole" Data="@usersWithRoles" RowSelect="@EditUserAsync" IsLoading="@isLoading" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
|
||||
<RadzenDataGrid TItem="AppUserWithRole" Data="@usersWithRoles" IsLoading="@isLoading" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
|
||||
<Columns>
|
||||
<RadzenDataGridColumn TItem="AppUserWithRole" Property="User.UserName" Title="Логин" />
|
||||
<RadzenDataGridColumn TItem="AppUserWithRole" Property="Role.Name" Title="Роль" />
|
||||
@ -41,6 +41,7 @@
|
||||
<Template Context="userWithRole">
|
||||
@if (userWithRole.User.Id != currentUserId)
|
||||
{
|
||||
<RadzenButton Click="@(() => EditUserAsync(userWithRole))" @onclick:stopPropagation="true" ButtonStyle="ButtonStyle.Primary" Icon="edit" Size="ButtonSize.Small" />
|
||||
<RadzenButton Click="@(() => DeleteUserAsync(userWithRole))" @onclick:stopPropagation="true" ButtonStyle="ButtonStyle.Danger" Icon="close" Size="ButtonSize.Small" />
|
||||
}
|
||||
</Template>
|
||||
@ -131,7 +132,7 @@
|
||||
try
|
||||
{
|
||||
if (await DialogService.Confirm(
|
||||
$"Вы уверены что хотите удалить пользователя '{userWithRole.User.UserName}'?",
|
||||
GetDeleteMessage(userWithRole.User.UserName),
|
||||
"Удаление пользователя",
|
||||
new ConfirmOptions()
|
||||
{
|
||||
@ -162,6 +163,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
RenderFragment GetDeleteMessage(string userName)
|
||||
{
|
||||
return __builder =>
|
||||
{
|
||||
<text>
|
||||
Вы уверены что хотите удалить пользователя <b>@userName</b>?
|
||||
</text>
|
||||
};
|
||||
}
|
||||
|
||||
async Task UpdateGridAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
@ -19,6 +19,7 @@ namespace Hcs.WebApp.Services
|
||||
return await (from user in context.Users
|
||||
join userRole in context.UserRoles on user.Id equals userRole.UserId
|
||||
join role in context.Roles on userRole.RoleId equals role.Id
|
||||
orderby role.Priority
|
||||
select new AppUserWithRole()
|
||||
{
|
||||
User = user,
|
||||
|
||||
Reference in New Issue
Block a user