コード例 #1
0
        public ActionResult UpdateProductPicNo()
        {
            string ProductListId = Request.Form["ProductListId"].Trim();
            SwfsFlagShipNewArrivalProductService service = new SwfsFlagShipNewArrivalProductService();
            SwfsFlagShipNewArrivalProductList    Product = service.SelectProductListId(ProductListId);
            string ProductFirstPicNo  = ""; //第一张图片
            string ProductSecondPicNo = ""; //第二张图片
            string aaa = Request.Files["FlapHotOne"].FileName;

            if (Request.Files["FlapHotOne"] == null || string.IsNullOrEmpty(Request.Files["FlapHotOne"].FileName))
            {
                return(Json(new { result = "error", message = "请上传图片!" }));
            }
            if (Request.Files["FlapHotTwo"] == null || string.IsNullOrEmpty(Request.Files["FlapHotTwo"].FileName))
            {
                return(Json(new { result = "error", message = "请上传图片!" }));
            }
            CommonService commonService       = new CommonService();
            Dictionary <string, string> rsPic = commonService.PostImg(Request.Files["FlapHotOne"], "width:160,Height:420,Length:150");

            if (rsPic.Keys.Contains("error"))
            {
                return(Json(new { result = "error", message = rsPic["error"] }));
            }
            if (rsPic.Keys.Contains("success"))
            {
                ProductFirstPicNo = rsPic["success"];
            }
            Dictionary <string, string> rsPic2 = commonService.PostImg(Request.Files["FlapHotTwo"], "width:160,Height:420,Length:150");

            if (rsPic2.Keys.Contains("error"))
            {
                return(Json(new { result = "error", message = rsPic["error"] }));
            }
            if (rsPic2.Keys.Contains("success"))
            {
                ProductSecondPicNo = rsPic2["success"];
            }
            try
            {
                Product.ProductFirstPicNo  = ProductFirstPicNo;
                Product.ProductSecondPicNo = ProductSecondPicNo;
                service.SelectProductListId(Product);
                return(Json(new { result = "success", message = "修改成功。" }));
            }
            catch (Exception ex)
            {
                return(Json(new { result = "error", message = ex.Message }));
            }
        }
コード例 #2
0
        /// <summary>
        /// 添加商品展示图页面
        /// </summary>
        /// <param name="brandNo">商品编号</param>
        /// <param name="DateShelf">上新时间</param>
        /// <returns></returns>
        public ActionResult AddProductImage(string ProductListId, string ArrivalId)
        {
            SwfsFlagShipNewArrivalProductService service = new SwfsFlagShipNewArrivalProductService();
            SwfsFlagShipNewArrivalProductList    Product = service.SelectProductListId(ProductListId);
            ProductInfoNew model = service.SelectProductInfoNewProductListId(ProductListId);

            ViewBag.ProductFirstPicNo  = Product == null ? "" : Product.ProductFirstPicNo;
            ViewBag.ProductSecondPicNo = Product == null ? "" : Product.ProductSecondPicNo;
            ViewBag.ArrivalId          = ArrivalId;
            return(View(model));
        }