private void CheckPostCodeValid(string postcode) { var validPostcode = _validatePostcode.Execute(postcode); if (!validPostcode) { throw new InvalidQueryParameterException("The Postcode given does not have a valid format"); } }
private void CheckPostcodeValid(string postcode) { if (string.IsNullOrEmpty(postcode)) { return; } if (!_validatePostcode.Execute(postcode)) { throw new InvalidQueryParameterException("The Postcode given does not have a valid format"); } }
public IList <HousingProperty> Execute(GetPropertiesRequest request) { //stop ef core query timeout if (string.IsNullOrEmpty(request.Postcode) && string.IsNullOrEmpty(request.Address)) { throw new InvalidQueryParameterException("Please check your query parameters"); } //check postcode format is valid if (!_validatePostcode.Execute(request.Postcode)) { throw new InvalidQueryParameterException("The postcode parameter does not have a valid format"); } var response = _gateway.GetPropertiesByPostcodeOrAddress(request); if (!response.Any()) { throw new PropertyNotFoundException(); } return(_mapper.Map <List <HousingProperty> >(response)); }