I am working on Asp.net WebApi2 and I want to send Model + validation to client.because then with validation client application can put those validations.
I can validate data sent by client application by creating class
public class CalibrationEntity : BaseEntity
{
[Required(AllowEmptyStrings = false)]
[RegularExpression(@"\d{0,3}", ErrorMessage = "The calno field must be in format XXX")]
public string calno { get; set; }
[Required(AllowEmptyStrings = false)]
[DataType(DataType.DateTime)]
public Nullable<System.DateTime> dte_createdon { get; set; }
[StringLength(10)]
public string equip_mode { get; set; }
}
I can use above class to validate data sent by client application to API but How can can I sent Model and validations to client ??