Пример #1
0
        public void Execute()
        {
            ValidateProductPrice validateProductPrice = new ValidateProductPrice();

            validateProductPrice.InputArgument = this.InputArgument;
            validateProductPrice.Execute();
            if (validateProductPrice.OutputArgument)
            {
                GetProduct getProduct = new GetProduct();
                getProduct.InputArgument = p => p.Code == this.InputArgument.Code;
                getProduct.Execute();
                if (getProduct.OutputArgument?.Count > 0 && getProduct.OutputArgument[0].Id != this.InputArgument.Id)
                {
                    throw new DuplicateProductException();
                }
                else
                {
                    this.InputArgument.LastUpdated = DateTime.Now;
                }
            }
            else
            {
                throw new ProductPriceValidationException();
            }
        }
Пример #2
0
        private void ValidatePrice()
        {
            ValidateProductPrice validateProductPrice = new ValidateProductPrice();

            validateProductPrice.InputArgument = this.InputArgument;
            validateProductPrice.Execute();
            if (!validateProductPrice.OutputArgument)
            {
                throw new ProductPriceValidationException();
            }
        }