public async Task <IActionResult> SelectTLevel() { _journeyInstance = _journeyInstanceProvider.GetOrCreateInstance( () => new AddTLevelJourneyModel()); if (!_journeyInstanceProvider.IsCurrentInstance(_journeyInstance)) { return(RedirectToAction() .WithProviderContext(_providerContext) .WithJourneyInstanceUniqueKey(_journeyInstance)); } var query = new SelectTLevel.Query() { ProviderId = _providerContext.ProviderInfo.ProviderId }; return(await _mediator.SendAndMapResponse(query, vm => View("SelectTLevel", vm))); }
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { // We need to be in a FormFlow journey for all of these pages (so we have somewhere to stage the changes) var tLevelId = Guid.Parse((string)context.RouteData.Values["tLevelId"]); _journeyInstance = await _journeyInstanceProvider.GetOrCreateInstanceAsync(() => _journeyModelFactory.CreateModel(tLevelId)); if (!_journeyInstanceProvider.IsCurrentInstance(_journeyInstance)) { context.Result = RedirectToActionPreserveMethod( ControllerContext.ActionDescriptor.ActionName, routeValues: new { tLevelId }) .WithJourneyInstanceUniqueKey(_journeyInstance); return; } await base.OnActionExecutionAsync(context, next); }
public IActionResult Index([FromQuery] string postcode, [FromQuery] string returnUrl) { var journeyInstance = _journeyInstanceProvider.GetOrCreateInstance( () => new AddVenueJourneyModel(), new PropertiesBuilder() .Add(ReturnUrlJourneyInstancePropertyKey, returnUrl) .Build()); if (!_journeyInstanceProvider.IsCurrentInstance(journeyInstance)) { return(RedirectToAction() .WithProviderContext(_providerContextProvider.GetProviderContext()) .WithJourneyInstanceUniqueKey(journeyInstance)); } return(View( nameof(PostcodeSearch), new PostcodeSearch.SearchCommand() { Postcode = postcode })); }