public async Task <IActionResult> Results() { var interviews = await _interviewService.GetPassedInterviewsAsync(); var candidates = await _userService.GetCandidatesAsync(); if (interviews?.Any() != true || candidates?.Any() != true) { return(RedirectToAction(nameof(HomeController.Error))); } var viewModels = new List <ResultViewModel>(); foreach (var interview in interviews) { var candidate = candidates.FirstOrDefault(e => e.Id == interview.CandidateId); if (candidate != null) { var exam = await _interviewService.GetExamAsync(interview.ExamId); viewModels.Add(ViewModelBuilder.GetResultViewModels(interview, candidate, exam)); } } return(View(viewModels.OrderByDescending(e => e.Score).ToList())); }