40 lines
970 B
C#
40 lines
970 B
C#
|
|
using BaseDomain;
|
|
|
|
namespace VCart.Domain
|
|
{
|
|
public class DateChanged : AValueObject
|
|
{
|
|
public DateChanged()
|
|
{
|
|
this.Value = DateTime.Now;
|
|
}
|
|
|
|
public DateChanged(DateTime dateTime)
|
|
{
|
|
this.Value = dateTime;
|
|
}
|
|
|
|
public DateTime? Value { get; private set; }
|
|
|
|
public override bool GetValidationExpression()
|
|
{
|
|
IsValid = true;
|
|
if (Value == null)
|
|
{
|
|
IsValid = false;
|
|
}
|
|
return IsValid;
|
|
}
|
|
|
|
protected override IEnumerable<object> GetEqualityComponents()
|
|
{
|
|
yield return Value;
|
|
}
|
|
|
|
public static implicit operator string(DateChanged d) => d.Value.Value.ToString("pt-BR");
|
|
public static explicit operator DateChanged(DateTime b) => new DateChanged(b);
|
|
public static explicit operator DateChanged(string b) => new DateChanged(b);
|
|
}
|
|
}
|