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(); } }
public CreateProduct() { productContext = ProductContext.GetContextInstance(); getProduct = new GetProduct(); }