public ActionResult Index() { if (HttpContext.GetOverriddenBrowser().IsMobileDevice) { return(View()); } HomeViewModel model = new HomeViewModel(); model.News = newsService.GetTop(3, orderBy: x => x.OrderByDescending(n => n.NewsDate)); List <Fixture> latestFixtures = fixtureService.GetLatestMatchResults(); // TODO Review Top player stats. Should MVP always be shown? foreach (Fixture fixture in latestFixtures) { model.LatestMatchResults.Add(new MatchResult() { Fixture = fixture, HomeTopPlayers = this.statsReportingService.GetTopPlayerStatsForFixture(fixture.Id, fixture.HomeTeamLeague.Id), AwayTopPlayers = this.statsReportingService.GetTopPlayerStatsForFixture(fixture.Id, fixture.AwayTeamLeague.Id) }); } List <League> currentLeagues = competitionService.GetLeaguesForCurrentSeason(); foreach (League league in currentLeagues) { model.Divisions.Add(new DivisionStandings() { Name = league.ToString(), Standings = competitionService.GetStandingsForLeague(league.Id) }); } model.NextEvents = eventService.GetNext(); model.CupCompetitions = cupService.GetCupsForCurrentSeason(); return(View(model)); }
public List <FixtureDto> GetLatestMatchResults(int numberOfMatchResults) { return((from result in fixtureService.GetLatestMatchResults(numberOfMatchResults) select new FixtureDto(result, false)).ToList()); }
public ActionResult ViewMatchResults() { List <Fixture> latestFixtures = fixtureService.GetLatestMatchResults(10); return(View(latestFixtures)); }