Esempio n. 1
0
        public ActionResult Edit(int?id)
        {
            EditProduct editProduct;

            if (id.HasValue)
            {
                editProduct = Mapper.Map <EditProduct>(Products.GetByID(id.Value));

                editProduct.Text               = HttpUtility.HtmlDecode(editProduct.Text);
                editProduct.GroupUrlPerfix     = Groups.GetByID(editProduct.GroupID.Value).UrlPerfix;
                editProduct.Groups             = ProductGroups.GetByProductID(editProduct.ID).Select(item => item.GroupID).ToList();
                editProduct.Images             = ProductImages.GetByProductID(editProduct.ID);
                editProduct.Files              = ProductFiles.GetByProductID(editProduct.ID);
                editProduct.Marks              = ProductMarks.GetByProductID(editProduct.ID);
                editProduct.Points             = ProductPoints.GetByProductID(editProduct.ID);
                editProduct.Keywords           = ProductKeywords.GetByProductID(editProduct.ID);
                editProduct.Notes              = ProductNotes.GetByProductID(editProduct.ID);
                editProduct.ProductPricesLinks = ProductPricesLinks.GetByProductID(editProduct.ID);

                editProduct.Supplies = ProductSupplies.GetByProductID(editProduct.ID);
                editProduct.Prices   = ProductPrices.GetByProductID(editProduct.ID);
                editProduct.Varients = ProductVarients.GetByProductID(editProduct.ID);

                editProduct.Discounts = ProductDiscounts.GetAllByProductID(editProduct.ID);
            }
            else
            {
                editProduct        = new EditProduct();
                editProduct.userID = UserID;
            }

            return(View(editProduct));
        }