I am using model validation for validating web api requests using:
ActionFilterAttribute
Is it possible for having a validation rule for model's property 'B' which is dependent upon the property 'A'. Consider this example for more clarification
public class ValidationModel
{
[Required]
public int? Id { get; set; }
public string Barcode { get; set; }
public string BarcodeType { get; set; }
}
The above model has an Id property which is required and Barcode, BarcodeType property which is optional, is it possible to set BarcodeType property to required if and only if there is any value in the Barcode property(if it is not null and an empty string)