Пример #1
0
        public bool CreateAccount(BankAccount account)
        {
            if (account == null)
            {
                return(false);
            }

            var headers  = HttpContext.Current.Request.Headers;
            var username = GetUsernameFromAuthHeader(headers["Authorization"]);

            if (!string.IsNullOrWhiteSpace(username))
            {
                var newAccount = new BankAccount()
                {
                    AccountId   = Guid.NewGuid(),
                    User        = username,
                    Balance     = account.Balance,
                    AccountType = account.AccountType
                };

                return(_bankAccountService.CreateBankAccount(newAccount));
            }

            return(false);
        }
        public BankAccountCreateResponse CreateBankAccount(BankAccountCreateRequest bankAccountCreateRequest)
        {
            BankAccountCreateResponse bankAccountCreateResponse = new BankAccountCreateResponse();
            BankAccount bankAccount = _bankAccountService.CreateBankAccount(bankAccountCreateRequest.CustomerName);

            bankAccountCreateResponse.BankAccountId = bankAccount.AccountNo;
            bankAccountCreateResponse.Success       = true;

            return(bankAccountCreateResponse);
        }