Esempio n. 1
0
        public static BirthDateVO Create(DateTime birthDate)
        {
            var instance = new BirthDateVO {
                Value = new DateTime(birthDate.Year, birthDate.Month, birthDate.Day)
            };

            ValidateInstance(instance);

            return(instance);
        }
Esempio n. 2
0
        public static void ValidateInstance(BirthDateVO instance)
        {
            // Validations goes here

            if (
                instance.Value == default(DateTime)
                ||
                instance.Value > DateTime.UtcNow.AddYears(-18)
                )
            {
                throw new DomainException(DomainExceptionCode.InvalidBirthDate);
            }
        }