public static Validation <FrozeAccount> Freeze (this AccountState @this, FreezeAccount cmd) { if (@this.Status == AccountStatus.Frozen) { return(Errors.AccountNotActive); } return(cmd.ToEvent()); }
public static Validation <(Event Event, AccountState NewState)> Freeze (this AccountState @this, FreezeAccount cmd) { if (@this.Status == AccountStatus.Frozen) { return(Errors.AccountNotActive); } var evt = cmd.ToEvent(); var newState = @this.Apply(evt); return(evt as Event, newState); }