public ActionResult Edit(int id) { Fixture fixture = null; User loggedInUser = membershipService.GetLoggedInUser(); // I don't particularly like this level of role checking, but I want to reuse this controller // for both roles so it'll do if (loggedInUser.SiteAdmin) { fixture = fixtureService.Get(id); } else { fixture = fixtureService.Get(id, loggedInUser.Team.Id); } if (fixture == null) { return(RedirectToAction("Index")); } MatchResultViewModel model = new MatchResultViewModel(); model.MapToModel(fixture); model.HomePlayerStats = model.MapToPlayerFixtureStats(this.statsReportingService.GetPlayerStatsForFixture(fixture.Id, fixture.HomeTeamLeague.Id), playerService.GetForTeam(fixture.HomeTeamLeague.Team.Id), fixture.HomeTeamLeague, fixture); model.AwayPlayerStats = model.MapToPlayerFixtureStats(this.statsReportingService.GetPlayerStatsForFixture(fixture.Id, fixture.AwayTeamLeague.Id), playerService.GetForTeam(fixture.AwayTeamLeague.Team.Id), fixture.AwayTeamLeague, fixture); return(View(model)); }
public MatchResultDto GetMatchResult(int fixtureId) { // TODO Stip HTML from report http://htmlagilitypack.codeplex.com/ Fixture fixture = fixtureService.Get(fixtureId); List <PlayerFixture> homePlayerStats = this.statsReportingService.GetPlayerStatsForFixture(fixture.Id, fixture.HomeTeamLeague.Id); List <PlayerFixture> awayPlayerStats = this.statsReportingService.GetPlayerStatsForFixture(fixture.Id, fixture.AwayTeamLeague.Id); return(new MatchResultDto(fixture, homePlayerStats, awayPlayerStats)); }
public ActionResult Cancel(int id) { Fixture fixtureToUpdate = fixtureService.Get(id); fixtureToUpdate.IsCancelled = "Y"; fixtureService.Update(fixtureToUpdate); fixtureService.Commit(); SuccessMessage(FormMessages.FixtureCancelled); return(RedirectToAction("Index")); }
public Fixture GetBiggestHomeWinForTeam(int teamId) { int?fixtureId = this.statsReportingRepository.GetFixtureIdForBiggestedHomeWinForTeam(teamId); if (!fixtureId.HasValue || fixtureId <= 0) { return(null); } return(fixtureService.Get(fixtureId.Value)); }
public ActionResult ViewMatch(int?id) { if (!id.HasValue) { return(RedirectToAction("Index", "Home")); } Fixture fixture = fixtureService.Get(id.Value); if (fixture == null) { return(RedirectToAction("Index", "Home")); } MatchStatsViewModel model = new MatchStatsViewModel() { Fixture = fixture, HomePlayerStats = this.statsReportingService.GetPlayerStatsForFixture(fixture.Id, fixture.HomeTeamLeague.Id), AwayPlayerStats = this.statsReportingService.GetPlayerStatsForFixture(fixture.Id, fixture.AwayTeamLeague.Id), FixtureHistory = fixtureService.GetHistoricFixturesBetweenTeams(fixture.HomeTeamLeague.Team.Id, fixture.AwayTeamLeague.Team.Id, fixture.Id) }; model.SetHistoryFixtureWins(); return(View(model)); }
public ActionResult View(int id) { Fixture @fixture = fixtureService.Get(id); return(View(@fixture)); }