public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { var value = values[parameterName].ToStringOrDefault(); return(PatternValidator.IsValidSlug(value)); }
public static IChainableConstraint <IStringConstraints> IsSlug(this IStringConstraints constraints, bool ignoreEmpty = true) { return(constraints.Satisfy(v => (ignoreEmpty && string.IsNullOrEmpty(v)) || PatternValidator.IsValidSlug(v))); }