using System;
using System.ComponentModel.DataAnnotations;

namespace MileageTraker.Web.Attributes
{
	public class DenyFutureDateAttribute : ValidationAttribute
	{
		public override bool IsValid(object value)
		{
			DateTime date;
			if(value == null || !DateTime.TryParse(value.ToString(), out date))
				return false;
			return date.Date <= DateTime.Today;
		}
	}
}