main
 1using presentation.windows.common;
 2using presentation.windows.common.messages;
 3using presentation.windows.server.domain.accounting;
 4using presentation.windows.server.orm;
 5
 6namespace presentation.windows.server.handlers
 7{
 8    public class CreateNewDetailAccountHandler : AbstractHandler<CreateNewDetailAccountCommand>
 9    {
10        AccountRepository accounts;
11        ServiceBus bus;
12
13        public CreateNewDetailAccountHandler(AccountRepository accounts, ServiceBus bus)
14        {
15            this.accounts = accounts;
16            this.bus = bus;
17        }
18
19        public override void handle(CreateNewDetailAccountCommand item)
20        {
21            accounts.save(DetailAccount.New(Currency.named(item.currency)));
22            bus.publish<NewAccountCreated>(x => x.name = item.account_name);
23        }
24    }
25}