public async Task <IActionResult> OnGetAsync(int id) { var gameSession = await gameSessionRepository.GetGameSessionAsync(id); if (gameSession == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(int id) { GameSession = await gameSessionRepository.GetGameSessionAsync(id); if (GameSession == null) { return(NotFound()); } Answers = await gameSessionRepository.GetGameSessionQuestionsAndAnswersAsync(id); Duration = GameSession.EndTime - GameSession.StartTime; Score = Answers.Aggregate(0, (accumulator, answer) => answer.Choice.IsCorrect ? accumulator + (int)answer.Choice.Question.Difficulty + 1 : accumulator); Total = Answers.Aggregate(0, (accumulator, answer) => accumulator + (int)answer.Choice.Question.Difficulty + 1); return(Page()); }