DataAnotation to validate a model, how do I validate it so that the date is not in the future?

Viewed 5044

I have the Review Model, I am trying to validate the model, so that when the user selects a date, it can't be the date in the future.

Review.cs

public class Review : BaseEntity{

    [Key]
    public int Id {get; set;}

    [Required(ErrorMessage="You need a restaurant name!")]
    public string RestaurantName {get; set;}

    [What do I put in here??]
    public DateTime Date {get; set;}


}

I am a newbie, and the documentation is kind of hard to understand.

Thank you so much for your help in advance.

3 Answers
Related