using System.ComponentModel.DataAnnotations; using MileageTraker.Web.Models; using MileageTraker.Web.Utility; namespace MileageTraker.Web.Attributes { public class MileageLogTypeValid : ValidationAttribute { public override bool IsValid(object value) { if (value == null) return false; return typeof (MileageLogType).IsValidValue(value.ToString()); } } }