示例#1
0
        public async Task <IActionResult> Index(
            string form,
            string path,
            string subPath = "")
        {
            var queryParamters = Request.Query;
            var response       = await _pageService.ProcessPage(form, path, subPath, queryParamters);

            if (response == null)
            {
                return(RedirectToAction("NotFound", "Error"));
            }

            if (response.ShouldRedirect)
            {
                var routeValuesDictionary = new RouteValueDictionaryBuilder()
                                            .WithValue("path", response.TargetPage)
                                            .WithValue("form", form)
                                            .WithQueryValues(queryParamters)
                                            .Build();

                return(RedirectToAction("Index", routeValuesDictionary));
            }

            return(View(response.ViewName, response.ViewModel));
        }
        public async Task <IActionResult> Index(
            string form,
            string path,
            Dictionary <string, string[]> formData)
        {
            var viewModel      = formData.ToNormaliseDictionary(string.Empty);
            var queryParamters = Request.Query;
            var baseForm       = await _schemaFactory.Build(form);

            if (baseForm == null)
            {
                throw new ApplicationException($"Requested form '{form}' could not be found.");
            }

            var page = baseForm.GetPage(_pageHelper, path);

            if (page == null)
            {
                throw new ApplicationException($"Requested path '{path}' object could not be found for form '{form}'");
            }

            var sessionGuid = _sessionHelper.GetSessionGuid();

            await _bookingService.ProcessMonthRequest(viewModel, baseForm, page, sessionGuid);

            var routeValuesDictionary = new RouteValueDictionaryBuilder()
                                        .WithValue("path", path)
                                        .WithValue("form", form)
                                        .WithQueryValues(queryParamters)
                                        .Build();

            return(RedirectToAction("Index", "Home", routeValuesDictionary));
        }
示例#3
0
        public async Task <IActionResult> Index(
            string form,
            string path,
            Dictionary <string, string[]> formData)
        {
            var viewModel      = formData.ToNormaliseDictionary(string.Empty);
            var queryParamters = Request.Query;

            await _bookingService.ProcessMonthRequest(viewModel, form, path);

            var routeValuesDictionary = new RouteValueDictionaryBuilder()
                                        .WithValue("path", path)
                                        .WithValue("form", form)
                                        .WithQueryValues(queryParamters)
                                        .Build();

            return(RedirectToAction("Index", "Home", routeValuesDictionary));
        }
 public void SetUp()
 {
     _routeValues = RouteValueDictionaryBuilder.ExtractRouteValues <TestController, RedirectResult>(c => c.MethodWithRedirectResult());
 }
 public void SetUp()
 {
     _routeValues = RouteValueDictionaryBuilder.ExtractRouteValues <TestController, ActionResult>(c => c.MethodWithOneParameter(42));
 }
 public void SetUp()
 {
     _routeValues = RouteValueDictionaryBuilder.ExtractRouteValues <TestController, ActionResult>(c => c.MethodWithSeveralParameters(42, true, "bork bork bork"));
 }
 public void SetUp()
 {
     _routeValues = RouteValueDictionaryBuilder.ExtractRouteValues <TestController, ActionResult>(c => c.SimpleMethodWithNoParameters());
 }