Exemplo n.º 1
0
        public static async Task <MatchDetailResponse> FetchMatch(long gameId)
        {
            string path = $"match/v4/matches/{gameId}?api_key={ApiHelper.API_KEY}";

            try
            {
                using (HttpResponseMessage response = await ApiHelper.RiotApiClient.GetAsync(path))
                {
                    if (response.IsSuccessStatusCode)
                    {
                        MatchDetailResponse matchResponse = await response.Content.ReadAsAsync <MatchDetailResponse>();

                        return(matchResponse);
                    }
                    else
                    {
                        Console.WriteLine("error getting summoner match");
                        return(null);
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult MatchDetail([FromBody] MatchDetailModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            /*
             * var clas = new Class1();
             * var Stadium = clas.GetMatchStadiumInfo(int.Parse(model.matchId));
             * var MPActivity = clas.GetMatchActivityPlayers(int.Parse(model.matchId));
             * var Players = clas.GetListOfPlayers(int.Parse(model.matchId));
             *
             * var result = new MatchDetailResponse();
             * result.matchDetail = clas.GetMatchDetailInfo(Stadium, MPActivity, Players);
             */
            var matchProcessor = new MatchProcessor();
            var response       = matchProcessor.RetrieveMatchDetails(int.Parse(model.matchId));
            var result         = new MatchDetailResponse();

            result.matchDetail = response;

            return(Ok(result));
        }