CLeanup and restructurisation

This commit is contained in:
Mikhail Shabanov committed 2020-05-23 11:43:14 +02:00
1 parent bfb9f11035
commit 8faccd45c9
104 files changed
+124 -2056

No files matched your search

@@ -0,0 +1,47 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using AutoMapper;
using WotBlitzStatisticsPro.Common.Model;
using WotBlitzStatisticsPro.WgApiClient;
using WotBlitzStatisticsPro.WgApiClient.Model;
namespace WotBlitzStatisticsPro.Logic
{
public class WargamingSearch : IWargamingSearch
{
private readonly IWargamingApiClient _wargamingApiClient;
private readonly IMapper _mapper;
public WargamingSearch(IWargamingApiClient wargamingApiClient, IMapper mapper)
{
_wargamingApiClient = wargamingApiClient;
_mapper = mapper;
}
public async Task<AccountsSearchResponse> FindAccounts(
string accountNick,
RealmType realmType,
RequestLanguage language)
{
var response = await _wargamingApiClient.FindAccounts(accountNick, realmType, language);
return new AccountsSearchResponse
{
AccountsCount = response.Count,
Accounts = _mapper.Map<List<WotAccountListResponse>, List<AccountsSearchResponseItem>>(response)
};
}
public async Task<ClanSearchResponse> FindClans(
string searchString,
RealmType realmType,
RequestLanguage language)
{
var response = await _wargamingApiClient.FindClans(searchString, realmType, language);
return new ClanSearchResponse
{
ClansCount = response.Count,
Clans = _mapper.Map<List<WotClanListResponse>, List<ClanSearchResponseItem>>(response)
};
}
}
}