Exemplo n.º 1
0
        /// <summary>
        /// 添加商品图片
        /// </summary>
        public ActionResult AddProductImage(string showImg, int displayOrder = 0, int pid = -1)
        {
            PartProductInfo partProductInfo = AdminProducts.AdminGetPartProductById(pid);

            if (partProductInfo == null)
            {
                return(PromptView(Url.Action("productimagelist", new { pid = pid }), "商品不存在"));
            }

            if (string.IsNullOrWhiteSpace(showImg))
            {
                return(PromptView(Url.Action("productimagelist", new { pid = pid }), "图片不能为空"));
            }

            ProductImageInfo productImageInfo = new ProductImageInfo
            {
                Pid          = pid,
                ShowImg      = showImg,
                IsMain       = 0,
                DisplayOrder = displayOrder,
                StoreId      = partProductInfo.StoreId
            };

            AdminProducts.CreateProductImage(productImageInfo);
            AddMallAdminLog("添加商品图片", "添加商品图片,商品ID为:" + pid);
            return(PromptView(Url.Action("productimagelist", new { pid = pid }), "商品图片添加成功"));
        }