public async Task <ActionResult> SearchForFrameworkProviders(string frameworkId, ProviderSearchResponseCodes?statusCode, string postcode, string keywords, string ukprn, string postcodeCountry, bool?isLevyPayingEmployer)
        {
            var query = new GetFrameworkProvidersQuery
            {
                FrameworkId = frameworkId,
                Postcode    = postcode,
                Keywords    = keywords
            };

            var response = await _mediator.Send(query);

            if (response.StatusCode.Equals(GetFrameworkProvidersResponse.ResponseCodes.NoFrameworkFound))
            {
                return(new HttpNotFoundResult());
            }

            var viewModel = _mappingService.Map <GetFrameworkProvidersResponse, ProviderSearchViewModel>(response);

            viewModel.PostUrl              = Url?.Action("FrameworkResults", "Provider");
            viewModel.HasError             = statusCode.HasValue && statusCode.Value != ProviderSearchResponseCodes.Success;
            viewModel.ErrorMessage         = ProviderSearchMapper.CreateErrorMessage(statusCode);
            viewModel.IsLevyPayingEmployer = isLevyPayingEmployer;
            viewModel.Ukprn = ukprn;

            return(View("SearchForProviders", viewModel));
        }
コード例 #2
0
 public void ShouldMapToTheCorrectMesssage(ProviderSearchResponseCodes input, string expected)
 {
     ProviderSearchMapper.CreateErrorMessage(input).Should().Be(expected);
 }