示例#1
0
    private static bool ValidatePostalCode(
        IRegularExpressionService regularExpressionService,
        IPostalCodeModel model,
        string country
        )
    {
        var regex = regularExpressionService.GetPostalCodeRegex(country);

        return(Regex.IsMatch(model.PostalCode, regex));
    }
    public bool ValidateUsPostalCode(IPostalCodeModel model)
    {
        var regex = _regularExpressionService.GetPostalCodeRegex("en-US");

        return(Regex.IsMatch(model.PostalCode, regex));
    }