private void RetreieveTransactions(RetreieveTransactionCommand retreieveTransactionCommand) { if (!_managedAccounts.TryGetValue(retreieveTransactionCommand.AccountId, out var account)) { account = Context.ActorOf(_system.DI().Props <CustomerActor>(), retreieveTransactionCommand.AccountId.ToString()); } account.Forward(retreieveTransactionCommand); }
private void ReplyTransactions(RetreieveTransactionCommand retreieveTransactionCommand) { _logger.Information("Retreieving transactions for account with id {accountId}", Self.Path.Name); using (var db = _dbContextFactory.Create()) { var account = db.Accounts.Include(p => p.Transactions).First(a => a.Id == Convert.ToInt64(Self.Path.Name)); Sender.Tell(account.Transactions); } }