Blazor server and client apps. With data service mocks

This commit is contained in:
Michael Shabanov committed 2020-02-09 18:07:45 +03:00
1 parent 1fa0b03555
commit a0ad7ca395
68 files changed
+1893

No files matched your search

@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Common;
namespace WotBlitzStatisticsPro.UI.AccountsSearch
{
public class AccountSearchComponent : ComponentBase
{
[Inject]
public IAccountsSearchService AccountsSearchService { get; set; }
public string SearchString { get; set; }
public int PageNumber { get; set; } = 0;
public int AccountsPerPage { get; set; } = 5;
public int TotalAccountsCount { get; set; }
public Dictionary<long, string> Accounts { get; set; }
public async Task FindAccounts()
{
ClearAccountsList();
var searchResult = await AccountsSearchService.FindAccounts(SearchString, AccountsPerPage, PageNumber);
TotalAccountsCount = searchResult.TotalAccountsCount;
Accounts = searchResult.Accounts;
}
private void ClearAccountsList()
{
Accounts = null;
}
}
}
@@ -0,0 +1,40 @@
@inherits AccountSearchComponent
<div class="container-fluid p-3">
<div class="form-group row">
<div class="col-sm-10">
<input id="searchString" class="form-control"
@bind-value="SearchString"
@bind-value:event="oninput"
placeholder="Enter account nick" />
</div>
<div class="col-sm-2">
<button class="btn"
type="button"
id="search-dropdown"
@onclick="FindAccounts">
<!--<fa-icon icon="search" size="xs"></fa-icon>-->
Search
</button>
</div>
</div>
@if (Accounts != null)
{
<div class="row">
<table class="table">
<tbody>
@foreach (var account in Accounts)
{
<tr>
<td>
<NavLink href="@($"accountinfo/{account.Key}")">
@account.Value
</NavLink>
</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>