public async Task <IActionResult> Get(
            Guid apprenticeshipId,
            Query query,
            [FromServices] JourneyModelInitializer journeyModelInitializer)
        {
            _journeyInstance = await _journeyInstanceProvider.GetOrCreateInstanceAsync(
                () => journeyModelInitializer.Initialize(apprenticeshipId));

            return(await _mediator.SendAndMapResponse(query, vm => View("ApprenticeshipAssessment", vm)));
        }
示例#2
0
        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            _journeyInstance = await _journeyInstanceProvider.GetOrCreateInstanceAsync(() =>
            {
                var venueId = Guid.Parse((string)context.RouteData.Values["venueId"]);
                return(_editVenueJourneyModelFactory.CreateModel(venueId));
            });

            await base.OnActionExecutionAsync(context, next);
        }
        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);
        }