C# Class CardShop.Models.Validator.Comparator

Inheritance: System.ComponentModel.DataAnnotations.ValidationAttribute, IClientValidatable
Show file Open project: egreene/PracticeGDVP

Public Methods

Method Description
Comparator ( string otherProperty, Operator op = Operator.EqualTo ) : System

Will compare propery you signify in the annotation. By default, the operator is equal to. You are compoaring against the field. so greater than is field > otherProperty

Comparator ( string otherProperty, string errorMessage, Operator op = Operator.EqualTo ) : System

Will compare propery you signify in the annotation. By default, the operator is equal to. You are compoaring against the field. so greater than is field > otherProperty

GetClientValidationRules ( ModelMetadata metadata, ControllerContext context ) : IEnumerable

Protected Methods

Method Description
IsValid ( object value, System.ComponentModel.DataAnnotations.ValidationContext ctx ) : System.ComponentModel.DataAnnotations.ValidationResult

Private Methods

Method Description
GetErrorMessage ( string propertyName ) : string

Method Details

Comparator() public method

Will compare propery you signify in the annotation. By default, the operator is equal to. You are compoaring against the field. so greater than is field > otherProperty
public Comparator ( string otherProperty, Operator op = Operator.EqualTo ) : System
otherProperty string the property you want to compare against
op Operator the operator enum you want to call in
return System

Comparator() public method

Will compare propery you signify in the annotation. By default, the operator is equal to. You are compoaring against the field. so greater than is field > otherProperty
public Comparator ( string otherProperty, string errorMessage, Operator op = Operator.EqualTo ) : System
otherProperty string the property you want to compare against
errorMessage string Custom message you want to display.
op Operator the operator enum you want to call in
return System

GetClientValidationRules() public method

public GetClientValidationRules ( ModelMetadata metadata, ControllerContext context ) : IEnumerable
metadata ModelMetadata
context ControllerContext
return IEnumerable

IsValid() protected method

protected IsValid ( object value, System.ComponentModel.DataAnnotations.ValidationContext ctx ) : System.ComponentModel.DataAnnotations.ValidationResult
value object
ctx System.ComponentModel.DataAnnotations.ValidationContext
return System.ComponentModel.DataAnnotations.ValidationResult