public ActionResult SoS() { ApplicationWeeklyStats myStats = new ApplicationWeeklyStats(); List<tbl_ff_matchups> matchups = new List<tbl_ff_matchups>(); int week = 1; if (Session["espn"] != null) { //Do a stat scrape myStats = Common.Functions.GetWeeklyStats("ESPN", Request.Params["leagueId"]); if (myStats == null) { SetTeamWeeklyStats(Request.Params["leagueId"], 3); myStats = Common.Functions.GetWeeklyStats("ESPN", Request.Params["leagueId"]); } } else return RedirectToAction("ESPN", "Login"); GetSchedules(ref week, ref matchups); ViewBag.Title = "Strength of Schedule"; ViewBag.LeagueId = Request.Params["leagueId"]; ViewBag.SeasonId = Request.Params["seasonId"]; ViewBag.Matchups = matchups; ViewBag.Week = week; return View(myStats); }
public ActionResult Team() { List<Player> myPlayers = new List<Player>(); ApplicationWeeklyStats myStats = new ApplicationWeeklyStats(); if (Session["yahoo"] != null) { myPlayers = GetPlayers(Request.Params["leagueId"], Request.Params["teamId"]); if(myPlayers.Count > 0) { Augment.UpdateOpponents(ref myPlayers); } //myStats = Functions.GetWeeklyStats("Yahoo", Request.Params["leagueId"]); //if (myStats == null) //{ // SetTeamWeeklyStats(Request.Params["leagueId"], 3); // myStats = Functions.GetWeeklyStats("Yahoo", Request.Params["leagueId"]); //} } else return RedirectToAction("Yahoo", "Login"); ViewBag.Title = "Some Team"; ViewBag.LeagueId = Request.Params["leagueId"]; ViewBag.TeamId = Request.Params["teamId"]; ViewBag.WeeklyStats = myStats; return View(myPlayers); }
public static void SetWeeklyStats(ApplicationWeeklyStats stats) { List<ApplicationWeeklyStats> applicationWeeklyStats = HttpContext.Current.Application["WeeklyStats"] as List<ApplicationWeeklyStats> ?? new List<ApplicationWeeklyStats>(); ApplicationWeeklyStats myStats = applicationWeeklyStats.Where(w => w.Website == stats.Website && w.LeagueId == stats.LeagueId).SingleOrDefault(); if (myStats != null) { applicationWeeklyStats.Remove(myStats); } applicationWeeklyStats.Add(stats); HttpContext.Current.Application["WeeklyStats"] = applicationWeeklyStats; }
public ActionResult WaiverWire() { List<Player> myPlayers = new List<Player>(); ApplicationWeeklyStats myStats = new ApplicationWeeklyStats(); if (Session["espn"] != null) { myPlayers = GetWaivers(Request.Params["leagueId"]); myStats = Common.Functions.GetWeeklyStats("ESPN", Request.Params["leagueId"]); if (myStats == null) { SetTeamWeeklyStats(Request.Params["leagueId"], 3); myStats = Common.Functions.GetWeeklyStats("ESPN", Request.Params["leagueId"]); } } else return RedirectToAction("ESPN", "Login"); ViewBag.Title = "Waiver Wire"; ViewBag.LeagueId = Request.Params["leagueId"]; ViewBag.TeamId = Request.Params["teamId"]; ViewBag.SeasonId = Request.Params["seasonId"]; ViewBag.WeeklyStats = myStats; return View(myPlayers); }