using System;
using System.ComponentModel.DataAnnotations;
namespace Retroactiune.DataAnnotations
{
public class DatetimeNotInThePast : ValidationAttribute
{
///
/// Validates the given DateTime object to be null or greater than the UtcNow date.
///
/// An DateTime object.
/// True if the date is null or in the future, false otherwise.
public override bool IsValid(object value)
{
// TODO: Test
var now = DateTime.UtcNow;
var date = value as DateTime?;
return !(date <= now);
}
}
}