public void ValidationFailedNoSearchCriteria()
        {
            //Arrange
            var viewModel = new CandidateSearchViewModel();

            //Act
            var result = _mediator.Search(viewModel);

            //Assert
            result.AssertValidationResult(CandidateMediatorCodes.Search.FailedValidation);
        }
        public ActionResult Search(CandidateSearchViewModel viewModel)
        {
            var response = _candidateMediator.Search(viewModel, User.GetUkprn());

            ModelState.Clear();

            switch (response.Code)
            {
            case CandidateMediatorCodes.Search.FailedValidation:
                response.ValidationResult.AddToModelState(ModelState, "SearchViewModel");
                return(View(response.ViewModel));

            case CandidateMediatorCodes.Search.Ok:
                return(View(response.ViewModel));

            default:
                throw new InvalidMediatorCodeException(response.Code);
            }
        }
        public ActionResult Index()
        {
            var response = _candidateMediator.Search();

            return(View("Search", response.ViewModel));
        }