Ejemplo n.º 1
0
        public static Validation <FrozeAccount> Freeze
            (this AccountState @this, FreezeAccount cmd)
        {
            if (@this.Status == AccountStatus.Frozen)
            {
                return(Errors.AccountNotActive);
            }

            return(cmd.ToEvent());
        }
Ejemplo n.º 2
0
        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);
        }