Ejemplo n.º 1
0
        public long Add(CheckingAccountRegisterCommand cmd)
        {
            var checkingAccount = Mapper.Map <CheckingAccountRegisterCommand, CheckingAccount>(cmd);

            checkingAccount.Client = _clientRepository.GetById(cmd.Client.Id) ?? throw new NotFoundException();

            var newCheckingAccount = _checkingAccountRepository.Add(checkingAccount);

            return(checkingAccount.Id);
        }
Ejemplo n.º 2
0
        public IHttpActionResult Post(CheckingAccountRegisterCommand cmd)
        {
            var validator = cmd.Validate();

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

            return(HandleCallback(() => _accountsService.Add(cmd)));
        }
Ejemplo n.º 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);
 }