Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
 private void CheckProductExists()
 {
     getProduct.InputArgument = p => p.Code == this.InputArgument.Code;
     getProduct.Execute();
     if (getProduct.OutputArgument != null && getProduct.OutputArgument.Count() > 0)
     {
         throw new  DuplicateProductException();
     }
 }