Exemple #1
0
        public Deposit(int id, Account account, decimal amount)
        {
            Id        = id;
            CreatedOn = DateTime.UtcNow;

            _account = account;
            _amount  = amount;

            Status = AccountCommandState.Unprocessed;
        }
Exemple #2
0
        public Transfer(int id, Account fromAccount, Account toAccount, decimal amount)
        {
            Id        = id;
            CreatedOn = DateTime.UtcNow;

            _fromAccount = fromAccount;
            _toAccount   = toAccount;
            _amount      = amount;

            Status = AccountCommandState.Unprocessed;
        }
        public void Execute()
        {
            if (_account.Balance >= _amount)
            {
                _account.Balance -= _amount;

                Status = AccountCommandState.ExecuteSucceeded;
            }
            else
            {
                Status = AccountCommandState.ExecuteFailed;
            }
        }
Exemple #4
0
        public void Execute()
        {
            _account.Balance += _amount;

            Status = AccountCommandState.ExecuteSucceeded;
        }