/// <summary>
 /// Adds the error to model state correctly for a property so we can use it on the client side.
 /// </summary>
 /// <param name="modelState"></param>
 /// <param name="result"></param>
 /// <param name="propertyAlias"></param>
 /// <param name="culture">The culture for the property, if the property is invariant than this is empty</param>
 internal static void AddPropertyError(this System.Web.Http.ModelBinding.ModelStateDictionary modelState,
                                       ValidationResult result, string propertyAlias, string culture = "")
 {
     if (culture == null)
     {
         culture = "";
     }
     modelState.AddValidationError(result, "_Properties", propertyAlias, culture);
 }
示例#2
0
 /// <summary>
 /// Adds the error to model state correctly for a property so we can use it on the client side.
 /// </summary>
 /// <param name="modelState"></param>
 /// <param name="result"></param>
 /// <param name="propertyAlias"></param>
 /// <param name="culture">The culture for the property, if the property is invariant than this is empty</param>
 internal static void AddPropertyError(this System.Web.Http.ModelBinding.ModelStateDictionary modelState,
                                       ValidationResult result, string propertyAlias, string culture = "")
 {
     if (culture == null)
     {
         culture = "";
     }
     modelState.AddValidationError(result, "_Properties", propertyAlias,
                                   //if the culture is null, we'll add the term 'invariant' as part of the key
                                   culture.IsNullOrWhiteSpace() ? "invariant" : culture);
 }