Пример #1
0
        public BankAccount()
        {
            _state  = null;
            _logger = Context.GetLogger();

            Receive <OpenBankAccount>(Handle);
            Receive <GetBankAccountState>(Handle);
        }
Пример #2
0
        private bool Handle(OpenBankAccount command)
        {
            _state = new BankAccountState(
                command.Id,
                command.Savings,
                command.Credit);

            _logger.Info("Opened Bank Account for Id={0}", command.Id);

            return(true);
        }
Пример #3
0
        private bool Handle(GetBankAccountState query)
        {
            var result = new BankAccountState(
                _state.UserId,
                _state.Savings,
                _state.Credit);

            Sender.Tell(result);

            _logger.Info("Query for Bank Account State returned for Id={0}", query.Id);
            return(true);
        }