//[Ignore] public void Script_Mlb_GetGameSummary() { int year = 2014; MlbAttendanceData.UpdateSeason(MlbSeasonType.Spring, year); MlbAttendanceData.UpdateSeason(MlbSeasonType.Regular, year); MlbAttendanceData.UpdateSeason(MlbSeasonType.PostSeason, year); }
public ActionResult Index() { int year = Convert.ToInt32(this.Request["SeasonList"]); bool performUpdate = (this.Request["Update"] == "Get Latest"); if (performUpdate) { //MlbAttendanceData.UpdateSeasonForTeam(MlbSeasonType.Spring, MlbTeamShortName.TOR, year); MlbAttendanceData.UpdateSeason(MlbSeasonType.Spring, year); MlbAttendanceData.UpdateSeason(MlbSeasonType.Regular, year); MlbAttendanceData.UpdateSeason(MlbSeasonType.PostSeason, year); } return(RedirectToAction("Index", "Mlb", new { seasonYear = year, update = performUpdate })); }
public ActionResult MlbAttendance() { Dictionary <string, Exception> results = new Dictionary <string, Exception>(); if (this.IsKeyValid()) { results.Add("MlbAttendanceData", this.Update(delegate() { int mlbYearToUpdate = DateTime.Now.Year; MlbAttendanceData.UpdateSeason(MlbSeasonType.Spring, mlbYearToUpdate); MlbAttendanceData.UpdateSeason(MlbSeasonType.Regular, mlbYearToUpdate); MlbAttendanceData.UpdateSeason(MlbSeasonType.PostSeason, mlbYearToUpdate); })); } return(Json(results, JsonRequestBehavior.AllowGet)); }
public void Mlb_UpdatePostSeasonForAllTeamsTest() { MlbSeasonType seasonType = MlbSeasonType.PostSeason; int seasonYear = 2002; List <MlbGameSummaryModel> result = MlbAttendanceData.UpdateSeason(seasonType, seasonYear); // For some reason, the final game of the world series is not included Assert.AreEqual(33, result.Count, "Verify that there were 33 games"); using (SportsDataContext db = new SportsDataContext()) { Assert.AreEqual(33, db.MlbGameSummaryModel_DbSet.Where(g => g.MlbSeasonType == seasonType && g.Year == seasonYear).Count(), "Verify that there are 33 games in the db"); } }
public void Mlb_UpdateRegularSeasonForTeamTest() { MlbSeasonType seasonType = MlbSeasonType.Regular; MlbTeamShortName teamName = MlbTeamShortName.SD; int seasonYear = 2005; List <MlbGameSummaryModel> result = MlbAttendanceData.UpdateSeasonForTeam(seasonType, teamName, seasonYear); Assert.AreEqual(81, result.Count, "Verify that there are 81 home games returned"); using (SportsDataContext db = new SportsDataContext()) { string teamNameString = teamName.ToString(); // http://stackoverflow.com/questions/5899683/linq-to-entities-does-not-recognize-the-method-system-string-tostring-method Assert.AreEqual(81, db.MlbGameSummaryModel_DbSet.Where(g => g.MlbSeasonType == seasonType && g.Home.Equals(teamNameString, StringComparison.InvariantCultureIgnoreCase) && g.Year == seasonYear).Count(), "Verify that there are 81 games in the db"); } }