public TeamModel ScrapeTeam(string teamId) { var players = GetPlayersOnTeam(teamId, out string teamName); var hotsLogsInterface = new HotSLogsApiInterface(); var playerModels = new List <PlayerModel>(); foreach (var player in players) { var playerId = string.Empty; var stats = hotsLogsInterface.GetPlayerStats(player.Value, out playerId); var details = new Dictionary <string, object> { { "PlayerId", playerId }, { "PlayerName", player.Key }, { "BattleTag", player.Value }, { "Stats", stats } }; var playerStats = HotSLogsScraper.ScrapeHeroPreferences(playerId); playerModels.Add(new PlayerModel(details, playerStats)); } return(new TeamModel { Name = teamName, Players = playerModels }); }
/// <summary> /// Get mmr of a player from their HotSLogs player id. /// </summary> /// <param name="playerId"></param> /// <returns></returns> public JsonResult PlayerMmr(string playerId) { var hotslogsInterface = new HotSLogsApiInterface(); return(Json(JsonConvert.SerializeObject(hotslogsInterface.GetPlayerStats(playerId)), JsonRequestBehavior.AllowGet)); }