public async Task <IActionResult> Index(InterviewViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var candidate = await _userService.InitCandidateAsync(model.Candidate.ToCandidateEntity()); var exam = await _interviewService.GetExamByCategoryAsync(model.Category.Id, model.SelectedExamType); if (candidate == null || exam == null) { return(RedirectToAction(nameof(HomeController.Error))); } var interview = await _interviewService.InitInterviewAsync(candidate.Id, exam.Id); return(RedirectToAction(nameof(Exam), new { id = interview.Id })); }