View Source
  Class ModelStateExtensions
  
  
  
  
    Inheritance
      System.Object
      
   
  
  Assembly: Umbraco.Web.Common.dll
  Syntax
  
    public static class ModelStateExtensions
   
  Methods
  
  
    View Source
  
  IsValid(ModelStateDictionary, String)
  Checks if there are any model errors on any fields containing the prefix
Declaration
  
    public static bool IsValid(this ModelStateDictionary state, string prefix)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary | state |  | 
      
        | System.String | prefix |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
    View Source
  
  ToErrorDictionary(ModelStateDictionary)
  
  
  Declaration
  
    public static IDictionary<string, object> ToErrorDictionary(this ModelStateDictionary modelState)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary | modelState |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | IDictionary<System.String, System.Object> |  | 
    
  
  
    View Source
  
  ToJsonErrors(ModelStateDictionary)
  Serializes the ModelState to JSON for JavaScript to interrogate the errors
Declaration
  
    public static JsonResult ToJsonErrors(this ModelStateDictionary state)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary | state |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Microsoft.AspNetCore.Mvc.JsonResult |  |