public ActionResult Index() { var topMatches = this.Data.Matches.All() .Take(3) .Project() .To<MatchViewModel>(); var bestTeams = this.Data .Teams .All() .OrderByDescending(x => x.Votes.Count) .Take(3) .Project() .To<TeamViewModel>(); var homeModelView = new HomeViewModel() { Matches = topMatches, Teams = bestTeams }; return this.View(bestTeams); }
public ActionResult Index() { var topMatches = this.Data.Matches.All() .OrderByDescending(m => m.Bets.Count()) .Take(3) .Project() .To<MatchViewModel>(); var bestTeams = this.Data.Teams.All() .OrderByDescending(t => t.Votes.Sum(v => v.VoteValue)) .Take(3) .Project() .To<TeamViewModel>(); var model = new HomeViewModel { Matches = topMatches, Teams = bestTeams }; return this.View(model); }