Esempio n. 1
0
        /// <summary>
        /// Deletes the given address from the database
        /// </summary>
        /// <param name="deleteWithdrawAddressCommand"></param>
        /// <returns></returns>
        public DeleteWithdrawAddressResponse DeleteAddress(DeleteWithdrawAddressCommand deleteWithdrawAddressCommand)
        {
            List <WithdrawAddress> withdrawAddresses = _withdrawAddressRepository.GetWithdrawAddressByAccountId(new AccountId(deleteWithdrawAddressCommand.AccountId));

            foreach (var withdrawAddress in withdrawAddresses)
            {
                if (withdrawAddress.BitcoinAddress.Value == deleteWithdrawAddressCommand.BitcoinAddress)
                {
                    _fundsPersistenceRepository.Delete(withdrawAddress);
                    return(new DeleteWithdrawAddressResponse(true, "Deletion successful"));
                }
            }
            return(new DeleteWithdrawAddressResponse(false, "Address not found"));
        }