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