Пример #1
0
        public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
        {
            var value = values[parameterName].ToStringOrDefault();

            return(PatternValidator.IsValidSlug(value));
        }
Пример #2
0
 public static IChainableConstraint <IStringConstraints> IsSlug(this IStringConstraints constraints, bool ignoreEmpty = true)
 {
     return(constraints.Satisfy(v => (ignoreEmpty && string.IsNullOrEmpty(v)) || PatternValidator.IsValidSlug(v)));
 }