public async Task <IActionResult> UpdateSearch(FindApprenticeshipSearchModel viewModel) { if (ModelState.IsValid) { return(RedirectToAction("SearchResults", new { route = viewModel.Route, postcode = viewModel.Postcode, distance = viewModel.Distance })); } viewModel.Routes = await _repository.GetRoutes(); return(View("~/Views/Apprentice/FindAnApprenticeship.cshtml", viewModel)); }
public IViewComponentResult Invoke(FormType type, object formViewModel, FindApprenticeshipSearchModel findApprenticeshipSearchModel) { var returnUrl = ViewContext?.HttpContext?.Request?.Path.ToString() ?? "/"; switch (type) { case FormType.faaUpdateSearch: return(View("faa-update-results", findApprenticeshipSearchModel)); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public async Task <IActionResult> UpdateSearch(FindApprenticeshipSearchModel viewModel) { if (ModelState.IsValid) { return(RedirectToAction("SearchResults", new { route = viewModel.Route, postcode = viewModel.Postcode, distance = viewModel.Distance })); } var staticContent = _mediator.GetModelForStaticContent(); var routes = _repository.GetRoutes(); await Task.WhenAll(staticContent, routes); viewModel.Routes = routes.Result; viewModel.Menu = staticContent.Result.Menu; viewModel.BannerModels = staticContent.Result.BannerModels; return(View("~/Views/Apprentice/FindAnApprenticeship.cshtml", viewModel)); }