示例#1
0
        public async Task <ActionResult> Top()
        {
            await SetNotificationsAsync();

            var currentUserId = User.Identity.GetUserId();

            TriviaTopPlayersViewModel viewModel = new TriviaTopPlayersViewModel();

            var topPlayers = await TriviaService.GetTopPlayersAsync();

            viewModel.Players = Mapper.Map <IReadOnlyCollection <Models.Profile>, IReadOnlyCollection <ProfileViewModel> >(topPlayers);

            viewModel.QuizCategories = await TriviaService.GetQuizCategoriesAsync();

            viewModel.TrendingQuizzes = await GetTrendingQuizzesAsync();

            viewModel.PopularQuizzes = await GetPopularQuizzesAsync();

            viewModel.RecentlyCompletedQuizzes = await TriviaService.GetUsersCompletedQuizzesAsync(currentUserId);

            return(View(viewModel));
        }