Hi Everybody,
I have a class Customermodel in which have birthday,birthmonth,birthyear properties.
So i am trying to create a valid date Rules for client side that but i am not able to create it.
I am facing issues at the time of birthday. because it is depend on birthmonth and birthyear.
birthday have multiple validation like:
birthday can not provide null. //working
birthday is alwase between 1-31 or can say can't greater then 31. ///working
birthday is 31 when birthmonth is 1,3...etc. ///not working
birthday is 30 when birthmonth is 4,6...etc. ///not working
birthday must be 28 when birthyear is not leapyear else 29 and month is 2. ///not working
public class Customermodel
{
public int? birtday{get;set;}
public int? birthmonth {get;set;}
public int? birthyear {get;set;}
}
[Validator(typeof(MyViewModelValidator))]
public class CustomerModel {
public int? BirthYear { get; set; }
public int? BirthMonth { get; set; }
public int? BirthDay { get; set; }
}
public class MyViewModelValidator : AbstractValidator<customermodel> {
public MyViewModelValidator() {
RuleFor(x => x.BirthDay ).NotNull();
}
}
please provide me the solution for that... really thanks