コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        public async void InitClassMasteryControllerAsync()
        {
            string GetDataAllChamp = await _DragonClient.GetAllChampAsync();

            _ListChampion = JsonConvert.DeserializeObject <ListAllChampModel>(GetDataAllChamp);
        }