コード例 #1
0
        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
 private static TransactionalAccountResult ToResult(TRAccount domainObject)
 {
     return(new TransactionalAccountResult
     {
         Description = domainObject.Description,
         AccountNumber = domainObject.AccountNumber,
         AccountType = (Application.Results.AccountType)Enum.Parse(typeof(Application.Results.AccountType), domainObject.AccountType.ToString()),
         FinancialInstitutionAccountId = domainObject.FinancialInstitutionAccountId,
         Id = domainObject.Id,
         UserId = domainObject.UserId,
         LastRefresh = domainObject.LastRefresh,
     });
 }