public async Task <IActionResult> Index(HomeIndexRequestViewModel viewModel) { if (viewModel == null) { return(BadRequest()); } if (!ModelState.IsValid) { var responseViewModel = new HomeIndexResponseViewModel() { ReferenceCode = viewModel.ReferenceCode }; return(View(responseViewModel)); } var reloadResponse = await assessmentService.ReloadUsingReferenceCode(viewModel.ReferenceCode).ConfigureAwait(false); if (reloadResponse) { return(RedirectTo("assessment/return")); } else { ModelState.AddModelError("ReferenceCode", "The reference could not be found"); var responseViewModel = new HomeIndexResponseViewModel() { ReferenceCode = viewModel.ReferenceCode }; ViewData["Title"] = "Error"; return(View(responseViewModel)); } }
public IActionResult Index() { var responseVm = new HomeIndexResponseViewModel(); return(View(responseVm)); }