public TransactionInputOutputDto(TransactionInputOutput txIo)
 {
     AddressId   = txIo.AddressId;
     AddressHash = txIo.Address?.Hash ?? null;
     Amount      = txIo.Amount;
     TransactionInputOutputType = txIo.TransactionInputOutputType;
 }
        public void RevertAggregateProperties(TransactionInputOutputType previousTxIoType, double previousAmount, int previousBlockHeight)
        {
            switch (previousTxIoType)
            {
            case TransactionInputOutputType.Input:
                SentAmount = Math.Round(SentAmount - previousAmount, 8);
                SentCount--;
                break;

            case TransactionInputOutputType.Output:
                ReceivedAmount = Math.Round(ReceivedAmount - previousAmount, 8);
                ReceivedCount--;
                break;
            }

            Balance = Math.Round(ReceivedAmount - SentAmount, 8);

            LastBlockHeight = previousBlockHeight;

            UpdatedOn = DateTime.Now;
        }
        public void ModifyAggregateProperties(TransactionInputOutputType txIoType, double amount, int lastBlockHeight)
        {
            switch (txIoType)
            {
            case TransactionInputOutputType.Input:
                SentAmount = Math.Round(SentAmount + amount, 8);
                SentCount++;
                break;

            case TransactionInputOutputType.Output:
                ReceivedAmount = Math.Round(ReceivedAmount + amount, 8);
                ReceivedCount++;
                break;
            }

            Balance = Math.Round(ReceivedAmount - SentAmount, 8);

            if (lastBlockHeight > LastBlockHeight)
            {
                LastBlockHeight = lastBlockHeight;
            }
        }