Beispiel #1
0
        public ActionResult Default()
        {
            var model = new HomeViewModel
                            {
                                Articles = _articleService.GetAll().OrderByDescending(x => x.UpdateTimestamp).Take(4).ToList()
                            };

            return View(model);
        }
        public ActionResult Index()
        {
            var homeViewModel = new HomeViewModel()
            {
                LatestContests = this.Data.Contests
                    .All()
                    .OrderByDescending(c => c.CreatedOn)
                    .Take(GlobalConstants.NumberOfContestsOnHomePage)
                    .ProjectTo<ContestViewModel>(),
                LatestUsers = this.Data.Users.All()
                    .OrderByDescending(u => u.JoinedOn)
                    .Take(GlobalConstants.NumberOfUsersOnHomePage)
                    .ProjectTo<UserViewModel>()
            };

            return View(homeViewModel);
        }
        public ActionResult Index()
        {
            var homeViewModel = new HomeViewModel()
            {
                BestTeams = this.Data.Teams.All()
                    .OrderByDescending(x => x.Votes.Count())
                    .Take(GlobalConstants.NumberOfTeamOnHomePage)
                    .Project()
                    .To<TeamViewModel>(),
                TopMatches = this.Data.Matches.All()
                    .OrderByDescending(x => x.UserMatchBets.Sum(s => s.AwayBet) + x.UserMatchBets.Sum(s => s.HomeBet))
                    .Take(GlobalConstants.NumberOfMatchesOnHomePage)
                    .Project()
                    .To<MatchViewModel>()
            };

            return View(homeViewModel);
        }