Exemple #1
0
        private void saveFeature(ProductFeatureModel productFeatureModel)
        {
            productFeatureModel.SelfCheck();

            Product product = Find(productFeatureModel.ParentId);

            product.IsNullThrowException("product");

            MenuFeature menuFeature = MenuFeatureBiz.Find(productFeatureModel.MenuFeatureId);

            menuFeature.IsNullThrowException("Menu feature not found.");

            //create a new product Feature and add it
            ProductFeature productFeature = ProductFeatureBiz.Factory() as ProductFeature;

            productFeature.ProductId     = product.Id;
            productFeature.MenuFeatureId = menuFeature.Id;
            productFeature.Comment       = productFeatureModel.Description;
            productFeature.Name          = menuFeature.FullName();

            product.ProductFeatures.Add(productFeature);
            SaveChanges();
        }
Exemple #2
0
        public void CreateNewFeature(CreateNewFeatureModel model)
        {
            model.SelfCheck();
            ProductFeature productFeature = ProductFeatureBiz.FindByName(model.FeatureName);

            if (productFeature.IsNull())
            {
                productFeature = ProductFeatureBiz.Factory() as ProductFeature;
                productFeature.IsNullThrowException("productFeature");

                productFeature.Name = model.FeatureName;
                ProductFeatureBiz.CreateAndSave(productFeature);
            }

            //create the new feature.
            Product product = Find(model.ParentId);

            product.IsNullThrowException("product");

            //taking a short cut.
            ProductFeatureModel productFeatureModel = new ProductFeatureModel(model.ParentId, "", productFeature.Id, model.ReturnUrl, model.Description);

            AddFeature(productFeatureModel);
        }
Exemple #3
0
 public void AddFeature(ProductFeatureModel productFeatureModel)
 {
     //first get the parent
     productFeatureModel.SelfCheck();
     saveFeature(productFeatureModel);
 }