public Fee ToDomainObject()
 {
     return(new Fee
     {
         FeeType = FeeType,
         MiningFee = MiningFee?.ToDomainObject(FeeAmount.AmountType.MiningFee),
         RelayFee = RelayFee?.ToDomainObject(FeeAmount.AmountType.RelayFee)
     });
 }
Пример #2
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (String.IsNullOrEmpty(FeeType))
            {
                yield return(new ValidationResult($"Fee: value for {nameof(FeeType)} must not be null or empty."));
            }
            if (MiningFee == null)
            {
                yield return(new ValidationResult($"Fee: null value for {nameof(MiningFee)} is invalid."));
            }
            else
            {
                if (!MiningFee.IsMiningFee())
                {
                    yield return(new ValidationResult($"Fee: type of {nameof(MiningFee)} is invalid ({MiningFee.FeeAmountType})."));
                }
                foreach (var result in MiningFee.Validate(validationContext))
                {
                    yield return(result);
                }
            }

            if (RelayFee == null)
            {
                yield return(new ValidationResult($"Fee: null value for {nameof(RelayFee)} is invalid."));
            }
            else
            {
                if (!RelayFee.IsRelayFee())
                {
                    yield return(new ValidationResult($"Fee: type of {nameof(RelayFee)} is invalid ({RelayFee.FeeAmountType})."));
                }
                foreach (var result in RelayFee.Validate(validationContext))
                {
                    yield return(result);
                }
            }
        }