public async Task <IActionResult> Location(LocationEditModel model, [FromQuery] bool wizard)
        {
            var employerInfoModel = GetVacancyEmployerInfoCookie(model.VacancyId);
            var response          = await _orchestrator.PostLocationEditModelAsync(model, employerInfoModel, User.ToVacancyUser());

            if (!response.Success)
            {
                response.AddErrorsToModelState(ModelState);
            }

            if (!ModelState.IsValid)
            {
                var vm = await _orchestrator.GetLocationViewModelAsync(model, employerInfoModel, User.ToVacancyUser());

                vm.SelectedLocation = model.SelectedLocation;
                vm.PageInfo.SetWizard(wizard);
                vm.CanShowBackLink = employerInfoModel != null || vm.PageInfo.IsWizard;
                vm.AddressLine1    = model.AddressLine1;
                vm.AddressLine2    = model.AddressLine2;
                vm.AddressLine3    = model.AddressLine3;
                vm.AddressLine4    = model.AddressLine4;
                vm.Postcode        = model.Postcode;
                return(View(vm));
            }

            DeleteVacancyEmployerInfoCookie();

            IActionResult result = wizard
                ? RedirectToRoute(RouteNames.Dates_Get)
                : RedirectToRoute(RouteNames.Vacancy_Preview_Get);

            return(result);
        }
 public async Task PostLocationEditModelAsync(LocationEditModel model, VacancyEmployerInfoModel vacancyEmployerInfoModel = null)
 {
     await Sut.PostLocationEditModelAsync(model, User, Vacancy.TrainingProvider.Ukprn.Value,
                                          vacancyEmployerInfoModel ?? new VacancyEmployerInfoModel
     {
         VacancyId = Vacancy.Id
     });
 }
        public async Task <IActionResult> Location(LocationEditModel m, [FromQuery] bool wizard)
        {
            var response = await _orchestrator.PostLocationEditModelAsync(m, User.ToVacancyUser(), User.GetUkprn());

            if (!response.Success)
            {
                response.AddErrorsToModelState(ModelState);
            }

            if (!ModelState.IsValid)
            {
                var vm = await _orchestrator.GetLocationViewModelAsync(m, User.GetUkprn());

                vm.PageInfo.SetWizard(wizard);
                return(View(vm));
            }

            return(wizard
                ? RedirectToRoute(RouteNames.Training_Get)
                : RedirectToRoute(RouteNames.Vacancy_Preview_Get, null, Anchors.AboutEmployerSection));
        }