private static IEnumerable <ModelClientValidationRule> GetRulesFromAttributes(PropertyVm property) { return(property.GetCustomAttributes() .SelectMany(attribute => UnobtrusiveValidationAttributeRules, (attribute, rule) => rule(property, attribute)) .Where(r => r != null)); }
public static bool HasAttribute <TAtt>(this PropertyVm propertyVm) { return(propertyVm.GetCustomAttributes().OfType <TAtt>().Any()); }
public static IHtmlString Placeholder(PropertyVm pi) { var placeHolderText = pi.GetCustomAttributes().OfType <DisplayAttribute>().Select(a => a.Prompt).FirstOrDefault(); return(Attr((!string.IsNullOrWhiteSpace(placeHolderText)), "placeholder", placeHolderText)); }