private void New(CommandLineApplication app)
        {
            app.Command("new", newCmd =>
            {
                newCmd.Description = "To create a new TransactionalAccount";
                newCmd.HelpOption();

                var userArgument        = newCmd.Option("--user-id", "The id of the user who owns the account", CommandOptionType.SingleValue);
                var fiAccountIdArgument = newCmd.Option("--fi-account-id", "The id of the financial instution account id", CommandOptionType.SingleValue);
                userArgument.IsRequired();
                fiAccountIdArgument.IsRequired();
                newCmd.OnExecute(async() =>
                {
                    var trAccount = new TRAccount(userArgument.Value(), "")
                    {
                        Description   = Prompt.GetString("Please enter the description", ""),
                        AccountNumber = Prompt.GetString("Please enter the account number", ""),
                        AccountType   = Enum.Parse <Account.Domain.AccountType>(Prompt.GetString("Please enter the account type")),
                        FinancialInstitutionAccountId = fiAccountIdArgument.Value()
                    };

                    var fiAccount = _repo.GetAsync(fiAccountIdArgument.Value()).Result;
                    fiAccount.AddTransactionalAccount(trAccount);
                    _repo.Add(fiAccount);
                    await _repo.UnitOfWork.SaveEntitiesAsync();
                });
            });
        }
예제 #2
0
        public async Task <bool> Handle(RefreshCommand request,
                                        CancellationToken cancellationToken)
        {
            var account = await _repo.GetAsync(request.FIAccountId);

            // TODO: Send request

            return(true);
        }