Exemple #1
0
        public static MyTeamViewModel PopulateMyTeamViewModel(string controller, string leagueId, string teamId, string year)
        {
            MyTeamViewModel model = new MyTeamViewModel();

            return model;
        }
Exemple #2
0
        public ActionResult MyTeam(/*int id*/)
        {
            var model = new MyTeamViewModel(/*id*/);

            string espnUrl = "http://games.espn.go.com/ffl/clubhouse?leagueId=372990&teamId=4&seasonId=2014";

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(espnUrl);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream stream = response.GetResponseStream();
            StreamReader reader = new StreamReader(stream);
            string html = reader.ReadToEnd();
            //Console.WriteLine(html);

            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(html);

            List<HtmlNode> players = new List<HtmlNode>();
            for (var i = 0; i < 100000; i++)
            {
                if (doc.GetElementbyId("playername_" + i.ToString()) != null)
                {
                    players.Add(doc.GetElementbyId("playername_" + i.ToString()));
                }
            }

            //remember to close the response!
            response.Close();
            return View(model);
        }