Ejemplo n.º 1
0
        public async Task <IActionResult> Exam(ExamViewModel model)
        {
            ModelState.Clear();

            var interview = await _interviewService.GetInterviewAsync(model.InterviewId);

            if (interview != null)
            {
                await _interviewService.SaveResponcesForInterviewAsync(ViewModelBuilder.GetExamResponses(model));

                if (await _interviewService.UpdateInterviewScoreAsync(interview, CalculationManager.CalculateFinalInterviewScore(model.Questions, model.Type)))
                {
                    return(RedirectToAction(nameof(Complete), new { id = interview.Id }));
                }
            }

            return(RedirectToAction(nameof(HomeController.Error)));
        }