示例#1
0
        public void Arrange()
        {
            _mockSessionService = new Mock <IMergeOrganisationSessionService>();
            _mockApiClient      = new Mock <IApiClient>();

            _viewModel = new ConfirmEpaoViewModel
            {
                EpaoId = "EPA0001"
            };

            Validator = new ConfirmEpaoViewModelValidator(_mockSessionService.Object, _mockApiClient.Object);
        }
        public IActionResult ConfirmEpao(string mergeOrganisationType, ConfirmEpaoViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            var mergeRequest = _mergeSessionService.GetMergeRequest();

            mergeRequest.UpdateEpao(viewModel.MergeOrganisationType, viewModel.EpaoId, viewModel.Name, viewModel.Ukprn.Value, viewModel.BackRouteSearchString);

            _mergeSessionService.UpdateMergeRequest(mergeRequest);

            return(RedirectToAction(nameof(MergeOverview)));
        }
        public async Task <IActionResult> ConfirmEpao(string mergeOrganisationType, string epaoId, string searchString)
        {
            if (searchString == null)
            {
                var mergeRequest = _mergeSessionService.GetMergeRequest();

                searchString = mergeRequest.PreviousCommand.SearchString;
            }

            var epao = await _apiClient.GetEpaOrganisation(epaoId);

            var viewModel = new ConfirmEpaoViewModel(epao, mergeOrganisationType, searchString);

            return(View(viewModel));
        }