public IHttpActionResult Delete(CheckingAccountRemoveCommand cmd) { var validator = cmd.Validate(); if (!validator.IsValid) { return(HandleValidationFailure(validator.Errors)); } return(HandleCallback(() => _accountsService.Remove(cmd))); }
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); }
public bool Remove(CheckingAccountRemoveCommand cmd) { var account = _checkingAccountRepository.GetById(cmd.Id) ?? throw new NotFoundException(); return(_checkingAccountRepository.Remove(account)); }