C# Class Rebel.Cms.Web.ModelStateExtensions

Afficher le fichier Open project: RebelCMS/rebelcmsxu5

Méthodes publiques

Méthode Description
AddDataValidationError ( this state, string errorMessage ) : void

Adds an error to the model state that has to do with data validation, this is generally used for JSON responses

IsValid ( this state, string prefix ) : bool

Checks if there are any model errors on any fields containing the prefix

Merge ( this state, ModelStateDictionary dictionary, string prefix ) : void

Merges ModelState that has names matching the prefix

ToJsonErrors ( this state ) : System.Web.Mvc.JsonResult

Serializes the ModelState to JSON for JavaScript to interrogate the errors

Method Details

AddDataValidationError() public static méthode

Adds an error to the model state that has to do with data validation, this is generally used for JSON responses
public static AddDataValidationError ( this state, string errorMessage ) : void
state this
errorMessage string
Résultat void

IsValid() public static méthode

Checks if there are any model errors on any fields containing the prefix
public static IsValid ( this state, string prefix ) : bool
state this
prefix string
Résultat bool

Merge() public static méthode

Merges ModelState that has names matching the prefix
public static Merge ( this state, ModelStateDictionary dictionary, string prefix ) : void
state this
dictionary ModelStateDictionary
prefix string
Résultat void

ToJsonErrors() public static méthode

Serializes the ModelState to JSON for JavaScript to interrogate the errors
public static ToJsonErrors ( this state ) : System.Web.Mvc.JsonResult
state this
Résultat System.Web.Mvc.JsonResult