27 lines
615 B
C#
27 lines
615 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace YAPContracts.Infrastructure
|
|
{
|
|
public class FutureDateAttribute : ValidationAttribute
|
|
{
|
|
public FutureDateAttribute()
|
|
{
|
|
ErrorMessage = "Date must be later than today";
|
|
}
|
|
|
|
public override bool IsValid(object? value)
|
|
{
|
|
if (value is DateTime date)
|
|
{
|
|
return date.Date >= DateTime.Today;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|