Browse Source

Get user list as an example.

pull/5399/head
Halil İbrahim Kalkan 6 years ago
parent
commit
cb0e920d83
  1. 32
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor

32
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor

@ -1,12 +1,28 @@
@page "/"
@using Volo.Abp.Identity
@inject IProfileAppService ProfileAppService
@inject IIdentityUserAppService UserAppService
<h1>Remote Service Test</h1>
<h2>Profile Application Service Test</h2>
<h4>Current user name: @_userName</h4>
<button class="btn btn-primary" @onclick="GetUserNameAsync">Click me (after login)</button>
<button class="btn btn-primary" @onclick="GetUserNameAsync">Get Profile Data (requires login)</button>
<h2>User Application Service Test</h2>
<button class="btn btn-primary" @onclick="GetUsersAsync">Get User list (requires login)</button>
@if (_users != null)
{
<ul class="mt-2">
@foreach (var user in _users)
{
<li>@user.UserName / @user.Email</li>
}
</ul>
<p>Total user count: @_totalUserCount</p>
}
@code
{
@ -18,4 +34,14 @@
_userName = (await ProfileAppService.GetAsync()).UserName;
}
}
private long _totalUserCount = 0;
private IReadOnlyList<IdentityUserDto> _users;
private async Task GetUsersAsync()
{
var result = await UserAppService.GetListAsync(new GetIdentityUsersInput());
_totalUserCount = result.TotalCount;
_users = result.Items;
}
}

Loading…
Cancel
Save