コード例 #1
0
        public ActionResult prodel(int SPUID)
        {
            goodsSPUTables spu = shop.goodsSPUTables.FirstOrDefault(x => x.SPUID == SPUID);

            shop.goodsSPUTables.Remove(spu);
            if (shop.SaveChanges() > 0)
            {
                var gsku = shop.goodsSKUTables.Where(c => c.SPUID == spu.SPUID).ToList();
                foreach (var item in gsku)
                {
                    shop.goodsSKUTables.Remove(item);
                }
                if (shop.SaveChanges() > 0)
                {
                    return(Content("true"));
                }
                else
                {
                    return(Content("false"));
                }
            }
            else
            {
                return(Content("false"));
            }
        }
コード例 #2
0
        public ActionResult Addproductinfo(goodsSPUTables spu, goodsSKUTables sku, ShopCategory sc, HttpPostedFileBase file)
        {
            if (file != null)
            {
                if (file.ContentLength != 0)
                {
                    file.SaveAs(Server.MapPath("~/Content/img/product/" + file.FileName));
                }
            }
            goodsSPUTables gspu = new goodsSPUTables();

            gspu.SPUGoodName = spu.SPUGoodName;
            gspu.GoodInfo    = spu.GoodInfo;
            gspu.ShopID      = sc.ShopID;
            shop.goodsSPUTables.Add(gspu);
            if (shop.SaveChanges() > 0)
            {
                return(Content("true"));
            }
            else
            {
                return(Content("false"));
            }
        }
コード例 #3
0
 //子商品添加
 public ActionResult addzzipro(goodsSPUTables spu)
 {
     ViewBag.SPUID       = shop.goodsSPUTables.FirstOrDefault(d => d.SPUID == spu.SPUID).SPUID;
     ViewBag.SPUGoodName = shop.goodsSPUTables.FirstOrDefault(d => d.SPUID == spu.SPUID).SPUGoodName;
     return(View());
 }