Пример #1
0
        public async Task <IActionResult> Index()
        {
            League = await LeagueClient.Connect();

            var region = await League.MakeApiRequest(LCUSharp.HttpMethod.Get, "/riotclient/region-locale");

            var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result);

            Summoners sum    = new Summoners(League);
            var       player = sum.GetCurrentSummoner();

            Summoner user = new Summoner();

            user.SummonerID   = player.SummonerId.ToString();
            user.SummonerName = player.DisplayName;
            user.Region       = locals.RegionRegion;
            user.Role         = "Test";
            return(View(user));
        }
Пример #2
0
        public async Task GetUserInfoAsync()
        {
            var region = await League.MakeApiRequest(LCUSharp.HttpMethod.Get, "/riotclient/region-locale");

            var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result);

            Summoners sum    = new Summoners(League);
            var       player = sum.GetCurrentSummoner();

            Summoner user = new Summoner();

            user.SummonerID   = player.SummonerId.ToString();
            user.SummonerName = player.DisplayName;
            user.Region       = locals.RegionRegion;
            user.Role         = "Test";

            http = new HttpClient();
            var content = new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json");
            await http.PostAsync("https://lossummonerinfoapi.azurewebsites.net/api/AddSummoner", content);
        }
Пример #3
0
        public async Task <IActionResult> Index()
        {
            try
            {
                League = await LeagueClient.Connect();

                Summoners sum  = new Summoners(League);
                var       prof = sum.GetCurrentSummoner();
                if (prof.AccountId == 0)
                {
                    return(View("NoApi"));
                }
                ViewBag.Name = prof.DisplayName;
                await GetUserInfoAsync();

                return(View(prof));
            }
            catch (Exception e)
            {
                return(View("NoApi"));
            }
            //CustomGamesManager cgm = new CustomGamesManager();
            //cgm.CreateOneOnOneGame("los", 20289202);
        }