Posted on: 1/27/2015 9:45:50 PM | Views : 603

I need to compare to 2 dates in Employee MOdel which is present in my WebAPI Service Layer.I am invoking this service from ASP.net webforms Application.
I already implemented Custom Validation attribute & applied it to the Model property like below. But I don't see any validation happening.Where I am making mistake ?
public class DateGreaterThanAttribute : ValidationAttribute { private const string _defaultErrorMessage = "'{0}' must be greater than '{1}'"; private string _basePropertyName;
public DateGreaterThanAttribute(string basePropertyName) : base(_defaultErrorMessage) { _basePropertyName = basePropertyName; }
public override string FormatErrorMessage(string name) { return string.Format(_defaultErrorMessage, name, _basePropertyName); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var basePropert ...

Go to the complete details ...