public void On(ISubscriptionContext <Guid> context, AmountTransferred evt)
        {
            if (evt.TransferRequest.FromAccount == context.Key)
            {
                Balance -= evt.TransferRequest.Amount;
            }
            else if (evt.TransferRequest.ToAccount == context.Key)
            {
                Balance += evt.TransferRequest.Amount;
            }

            LastModified = evt.Timestamp;
        }
Example #2
0
        public void On(ISubscriptionContext <Guid> context, AmountTransferred evt)
        {
            // if this account is the source of the transfer, decrease balance by amount
            if (evt.TransferRequest.FromAccount == context.Key)
            {
                Balance -= evt.TransferRequest.Amount;
            }

            // if this account is the destination of the transfer, increase balance by amount
            if (evt.TransferRequest.ToAccount == context.Key)
            {
                Balance += evt.TransferRequest.Amount;
            }

            LastModified = evt.Timestamp;
        }