Beispiel #1
0
        public void AddProductFeature(ProductFeature productFeature)
        {
            checkIfProductExists(productFeature.ProductId);
            checkIfProductAlreadyHasFeature(productFeature.FeatureId, productFeature.ProductId);
            Feature feature = getFeature(productFeature.FeatureId);

            productFeature.Validate();
            productFeature.CheckIfValueCorrespondsToType(feature);
            this.productFeatureRepo.Add(productFeature);
        }
Beispiel #2
0
        public void ModifyProductFeatureValue(Guid id, string val)
        {
            ProductFeature productFeature = productFeatureRepo.Get(id);

            if (productFeature != null)
            {
                productFeature.Value = val;
                productFeature.Validate();
                Feature feature = getFeature(productFeature.FeatureId);
                productFeature.CheckIfValueCorrespondsToType(feature);
                productFeatureRepo.Update(productFeature);
            }
            else
            {
                throw new NoProductFeatureException("No hay atributo de producto con este id");
            }
        }