예제 #1
0
        public ActionResult DeleteProductPic(int pictureID)
        {
            if (!AppData.IsManagerLogin)
            {
                return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
            }
            if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 4))
            {
                return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
            }

            ProductBLL        productBLL        = new ProductBLL();
            ProductPictureObj productPictureObj = productBLL.GetProductPicture(pictureID);

            if (productPictureObj == null)
            {
                return(Json(new { success = false, msg = "图片不存在" }));
            }

            System.IO.File.Delete(Config.MediaPath + productPictureObj.SavePath);
            productBLL.DeleteProductPicture(pictureID);
            return(Json(new { success = true }));
        }