Example #1
0
        public bool Update(CheckingAccountUpdateCommand cmd)
        {
            var accountDb = _checkingAccountRepository.GetById(cmd.Id) ?? throw new NotFoundException();

            var account = Mapper.Map(cmd, accountDb);

            return(_checkingAccountRepository.Update(account));
        }
Example #2
0
        public IHttpActionResult Update(CheckingAccountUpdateCommand cmd)
        {
            var validator = cmd.Validate();

            if (!validator.IsValid)
            {
                return(HandleValidationFailure(validator.Errors));
            }

            return(HandleCallback(() => _accountsService.Update(cmd)));
        }
Example #3
0
 public void SetUp()
 {
     AutoMapperInitializer.Reset();
     AutoMapperInitializer.Initialize();
     _checkingAccount         = ObjectMother.GetCheckingAccountValid();
     _checkingAccountRegister = Mapper.Map <CheckingAccountRegisterCommand>(_checkingAccount);
     _checkingAccountUpdate   = Mapper.Map <CheckingAccountUpdateCommand>(_checkingAccount);
     _checkingAccountRemove   = Mapper.Map <CheckingAccountRemoveCommand>(_checkingAccount);
     _mockRepositoryAccount   = new Mock <ICheckingAccountRepository>();
     _mockRepositoryClient    = new Mock <IClientRepository>();
     _service = new CheckingAccountService(_mockRepositoryAccount.Object, _mockRepositoryClient.Object);
 }