Exemple #1
0
        public ActionResult Product(int productID)
        {
            var product = Products.GetByID(productID).Clone(UserID);

            product.CreatedDate = DateTime.Now;

            Products.Insert(product);

            foreach (var item in ProductGroups.GetByProductID(productID))
            {
                ProductGroups.Insert(new ProductGroup()
                {
                    ProductID = product.ID,
                    GroupID   = item.GroupID
                });
            }

            foreach (var item in AttributeValues.GetByProductID(productID))
            {
                AttributeValues.Insert(new AttributeValue()
                {
                    ProductID         = product.ID,
                    AttributeID       = item.AttributeID,
                    AttributeOptionID = item.AttributeOptionID,
                    Value             = item.Value
                });
            }

            return(Redirect("/Admin/Products/Edit/" + product.ID));
        }