start date and end date model validation
public class CreateLeaveModel
{
public int LeavesTaken { get; set; }
public string Reason { get; set; }
public int Days { get; set; }
[Compare DateTime("StartDate < EndDate",ErrorMessage ="Start Date must be earlier than End Date")]
public DateTime StartDate { get; set; }
[Compare DateTime("StartDate < EndDate", ErrorMessage = "End Date must be later than Start Date")]
public DateTime EndDate { get; set; }
public int Status { get; set; } = 0;
}
what is the correct way?
Dinesh GabhanePosted Oct 24, 2019, 4:26 AM
rus tanPosted Oct 24, 2019, 7:55 PM
rus tanPosted Oct 24, 2019, 7:54 PM