/// <summary> /// Sets up the view model to contain a list of quizzes and whether or not the current user has completed those quizzes /// </summary> /// <param name="currentUserId"></param> /// <param name="viewModel"></param> /// <returns></returns> private async Task SetupQuizzesOnDashboardAsync(string currentUserId, DashboardViewModel viewModel) { var quizzes = await TriviaService.GetQuizzesAsync(); viewModel.Quizzes = Mapper.Map <IReadOnlyCollection <Quiz>, IReadOnlyCollection <QuizOverviewViewModel> >(quizzes); var completedQuizzes = await TriviaService.GetCompletedQuizzesByUserAsync(currentUserId); foreach (var quiz in viewModel.Quizzes) { if (completedQuizzes.Any(q => q.Key == quiz.Id)) { quiz.IsComplete = true; } } }