Example #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));
            }
        }
        public async Task <ActionResult <MasteriesModel> > GetMasteriesIdAsync(string summonerName)
        {
            _logger.LogInformation($"Trying to get masteries account League Of Legend by name: {summonerName}");

            try {
                var token   = _settings.GetSection("lol").GetSection("token").Value;
                var Account = await _AccountClient.GetAccountByNameAsync(token, summonerName);

                var ResAccount    = JsonConvert.DeserializeObject <AccountModel>(Account);
                var MasteriesUser = await _MasteryClient.GetMasteryAsync(token, ResAccount.id);

                var Result = new MasteriesModel();
                Result.level = MasteriesUser;
                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));
            }
        }
Example #3
0
        public async Task <ActionResult <AccountModel> > GetAccountIdAsync(string summonerName)
        {
            _logger.LogInformation($"Trying to get account League Of Legend by name: {summonerName}");

            try {
                var token    = _settings.GetSection("lol").GetSection("token").Value;
                var UserData = await _AccountClient.GetAccountByNameAsync(token, summonerName);

                var result = JsonConvert.DeserializeObject <AccountModel>(UserData);
                result.profileIconId = "http://ddragon.leagueoflegends.com/cdn/9.21.1/img/profileicon/" + result.profileIconId + ".png";
                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));
            }
        }
Example #4
0
        public async Task <ActionResult <TftListHistoryModel> > GetTftHistoryAsync(string summonerName)
        {
            _logger.LogInformation($"Trying to get last games tft by name: {summonerName}");

            try {
                var token   = _settings.GetSection("tft").GetSection("token").Value;
                var Account = await _AccountClient.GetAccountByNameAsync(token, summonerName);

                var ResAccount  = JsonConvert.DeserializeObject <AccountModel>(Account);
                var HistoryUser = await _TftClient.GetListHistoryAsync(token, ResAccount.puuid);

                TftListHistoryModel Result = new TftListHistoryModel();
                Result.data = HistoryUser;
                return(Result);
            } catch (ApiException exception) {
                _logger.LogInformation($"Trying to get last games tft by name: {exception.StatusCode}");
                return(StatusCode((int)exception.StatusCode));
            }
            catch (Exception exc)
            {
                _logger.LogInformation($"Critical error: {exc.Message}");
                return(StatusCode(500));
            }
        }