public async Task <ActionResult <ListHistoryModel> > GetListGamesAsync(string summonerName) { _logger.LogInformation($"Trying to get 100 last games League Of Legend by name: {summonerName}"); try { if (_ListChampion == null) { var GetValueAllChamp = await _DragonClient.GetAllChampAsync(); _ListChampion = JsonConvert.DeserializeObject <ListAllChampModel>(GetValueAllChamp); } var token = _settings.GetSection("lol").GetSection("token").Value; var Account = await _AccountClient.GetAccountByNameAsync(token, summonerName); var ResAccount = JsonConvert.DeserializeObject <AccountModel>(Account); var GamesUser = await _HistoryClient.GetListHistoryAsync(token, ResAccount.accountId); var Result = JsonConvert.DeserializeObject <ListHistoryModel>(GamesUser); Result = AnalyseDatasGetGale(Result); return(Result); } catch (ApiException exception) { _logger.LogInformation($"Echec to get 100 last games League Of Legend by name: {exception.StatusCode}"); return(StatusCode((int)exception.StatusCode)); } catch (Exception exc) { _logger.LogInformation($"Critical error: {exc.Message}"); return(StatusCode(500)); } }
public async Task <ActionResult <List <MasteriesClassDetail> > > GetDetailsMasteriesAsync(string summonerName) { _logger.LogInformation($"Trying to get masteries account League Of Legend by name: {summonerName}"); try { if (_ListChampion == null) { var GetValueAllChamp = await _DragonClient.GetAllChampAsync(); _ListChampion = JsonConvert.DeserializeObject <ListAllChampModel>(GetValueAllChamp); } var token = _settings.GetSection("lol").GetSection("token").Value; var Account = await _AccountClient.GetAccountByNameAsync(token, summonerName); var ResAccount = JsonConvert.DeserializeObject <AccountModel>(Account); var AllMasteriesUser = await _MasteryClient.GetDetailsMasteryAsync(token, ResAccount.id); var result = JsonConvert.DeserializeObject <List <MasteriesClassDetail> >(AllMasteriesUser); result.ForEach(delegate(MasteriesClassDetail tmp) { tmp.name = GetNameChampion(tmp.championId); tmp.linkPicture = "http://ddragon.leagueoflegends.com/cdn/9.22.1/img/champion/" + GetPictureChampion(tmp.championId); }); return(result); } catch (ApiException exception) { _logger.LogInformation($"Echec to get account League Of Legend by name: {exception.StatusCode}"); return(StatusCode((int)exception.StatusCode)); } catch (Exception exc) { _logger.LogInformation($"Critical error: {exc.Message}"); return(StatusCode(500)); } }
public async Task <ActionResult <GameModel> > GetGameAsync(long matchId) { _logger.LogInformation($"Trying to get 100 last games League Of Legend by name: {matchId}"); try { if (_ListChampion == null) { var GetValueAllChamp = await _DragonClient.GetAllChampAsync(); _ListChampion = JsonConvert.DeserializeObject <ListAllChampModel>(GetValueAllChamp); } if (_ListItems == null) { var GetValueAllItems = await _DragonClient.GetAllItemsAsync(); _ListItems = JsonConvert.DeserializeObject <ListItemsModel>(GetValueAllItems); } if (_ListSummoners == null) { var GetValueAllSummoners = await _DragonClient.GetAllSummonersAsync(); _ListSummoners = JsonConvert.DeserializeObject <ListSummonersModel>(GetValueAllSummoners); } var token = _settings.GetSection("lol").GetSection("token").Value; var GamesUser = await _GameClient.GetGameAsync(token, matchId); var Result = JsonConvert.DeserializeObject <GameModel>(GamesUser); AnalyseTeam(Result); AnalyseParticipants(Result); return(Result); } catch (ApiException exception) { _logger.LogInformation($"Echec to get 100 last games League Of Legend by name: {exception.StatusCode}"); return(StatusCode((int)exception.StatusCode)); } catch (Exception exc) { _logger.LogInformation($"Critical error: {exc.Message}"); return(StatusCode(500)); } }
public async Task <ActionResult <List <ChampRotationList> > > GetRotationChampionsAsync() { _logger.LogInformation("Trying to get Rotation Champion League Of Legend"); try { if (_ListChampion == null) { var GetValueAllChamp = await _DragonClient.GetAllChampAsync(); _ListChampion = JsonConvert.DeserializeObject <ListAllChampModel>(GetValueAllChamp); } var token = _settings.GetSection("lol").GetSection("token").Value; var AllMasteriesUser = await _RotationClient.GetRotationChampionsAsync(token); var result = JsonConvert.DeserializeObject <RotationModel>(AllMasteriesUser); string name; ChampRotationList tmpRotation = null; List <ChampRotationList> tmpListRotation = new List <ChampRotationList>(); foreach (var IdChamp in result.freeChampionIds) { tmpRotation = new ChampRotationList(); name = GetNameChampion(IdChamp); tmpRotation.id = IdChamp; tmpRotation.name = name; tmpRotation.linkPicture = "http://ddragon.leagueoflegends.com/cdn/9.22.1/img/champion/" + GetPictureChampion(IdChamp); tmpListRotation.Add(tmpRotation); } return(tmpListRotation); } catch (ApiException exception) { _logger.LogInformation($"Echec to get Rotation Champion League Of Legend: {exception.StatusCode}"); return(StatusCode((int)exception.StatusCode)); } catch (Exception exc) { _logger.LogInformation($"Critical error: {exc.Message}"); return(StatusCode(500)); } }
public async void InitClassMasteryControllerAsync() { string GetDataAllChamp = await _DragonClient.GetAllChampAsync(); _ListChampion = JsonConvert.DeserializeObject <ListAllChampModel>(GetDataAllChamp); }