public async Task CreateAccount_Valid()
        {
            // Arrange
            var account = _stubAccounts[0];

            account.Id       = Guid.NewGuid();
            account.LastName = "Test";

            // Act
            var success = await _accountsService.CreateAccount(account);

            //Assert
            Assert.IsNotNull(success);
            Assert.IsTrue(success);
        }
예제 #2
0
        public void AccountTests_AddAccount()
        {
            //Arrange
            var person_code = 1;
            var model       = new AccountsBuilder()
                              .WithRandomProps()
                              .WithPersonCode(person_code)
                              .WithActive(true)
                              .Build();

            //Act
            _service.CreateAccount(model);

            //Assert
            Assert.IsTrue(_context.Account.Any(i => i.Code == model.Code));
        }
예제 #3
0
        public IHttpActionResult PostAccount(Account account)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            accountsService.CreateAccount(account);

            return(CreatedAtRoute("DefaultApi", new { id = account.Id }, account));
        }
        public async Task <IActionResult> CreateAccount(CustomerAccountDto customerAccount)
        {
            _logger.LogInformation("Creating new customer account");
            if (customerAccount == null)
            {
                _logger.LogError("Failed to get create due to invalid or no account information");
                throw new ArgumentException(nameof(customerAccount));
            }
            var success = await _accountsService.CreateAccount(customerAccount);

            if (success)
            {
                _logger.LogInformation("Successfully created new account");
                return(Ok(success));
            }
            _logger.LogError("Failed to get account with account info: " + customerAccount);
            return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
        }
        public async Task <IActionResult> LogInCallBack()
        {
            if (!(await _accountsService.Exists(User.GetNameIdentifier())))
            {
                Account account = new Account
                {
                    Id             = Guid.NewGuid(),
                    NameIdentifier = User.GetNameIdentifier(),
                    Name           = User.GetName(),
                    Email          = User.GetEmail(),
                    Picture        = User.GetProfileImage()
                };

                await _accountsService.CreateAccount(account);
            }

            return(Redirect(TempData["returnUrl"].ToString()));
        }
예제 #6
0
        public async Task <IActionResult> CreateAccount([FromBody] CreateAccountRequest request)
        {
            await _accountsService.CreateAccount(request);

            return(Ok());
        }
예제 #7
0
 public async Task Handle(CreatedAccountEvent createdAccount)
 {
     await _accountsService.CreateAccount(createdAccount.AccountId, createdAccount.Name);
 }
예제 #8
0
 public AccountModel CreateAccount(AccountModel account)
 {
     _accountsService.CreateAccount(account?.ToDomain());
     return(account);
 }
예제 #9
0
 public Task <AccountDTO> Handle(string accountName, Guid ownerId)
 {
     return(_accountsService.CreateAccount(accountName, ownerId));
 }
        public async Task <IActionResult> CreateAccount(AccountCardCreateRequest accountCardCreateRequest)
        {
            var accountDTO = await _accountsService.CreateAccount(accountCardCreateRequest);

            return(Ok(accountDTO));
        }
예제 #11
0
 public ResponseModel <List <AccountsModel> > CreateAccount(AccountsModel model)
 {
     _logger.Debug($"CreateAccount with payload: {JsonConvert.SerializeObject(model)}");
     return(_accountservice.CreateAccount(model));
 }