public ActionResult Insect_ShooppingOrderFountList(B_ShooppingOrderFountList OK, int ShoppingID, bool state) { string strMag = "fali"; ReturnJsonVo returnJson = new ReturnJsonVo(); try { // int oldWareHouseRows = (from tb in myModels.B_ShooppingOrderFountList where tb.ShooppingNumber == OK.ShooppingNumber select tb).Count(); if (oldWareHouseRows == 0) { B_ShooppingOrderFountList MyB_ConverList = new B_ShooppingOrderFountList(); MyB_ConverList.ShooppingNumber = OK.ShooppingNumber; MyB_ConverList.ShooppingTime = OK.ShooppingTime; MyB_ConverList.Message = OK.Message; myModels.B_ShooppingOrderFountList.Add(MyB_ConverList); if (myModels.SaveChanges() > 0) { B_ShoppingList wafrtbool = (from tbbool in myModels.B_ShoppingList where tbbool.ShoppingID == ShoppingID select tbbool).Single(); // wafrtbool.SubmitNot = state; //购物 myModels.Entry(wafrtbool).State = EntityState.Modified; if (myModels.SaveChanges() > 0)//保存 { returnJson.State = true; returnJson.Text = "修改成功"; } else { returnJson.State = false; returnJson.Text = "修改失败"; } strMag = "succsee"; B_ShooppingDateilIDOrderFounList ShooppingDeTailList = new B_ShooppingDateilIDOrderFounList(); ShooppingDeTailList.ShooppingOrderFountID = MyB_ConverList.ShooppingOrderFountID; //定单ID ShooppingDeTailList.ShoppingID = ShoppingID; //ShoppingID myModels.B_ShooppingDateilIDOrderFounList.Add(ShooppingDeTailList); myModels.SaveChanges(); } } } catch (Exception e) { Console.WriteLine(e); } return(Json(new { strMag, returnJson }, JsonRequestBehavior.AllowGet)); }
/// <summary> ///移除 /// </summary> /// <returns></returns> public ActionResult DeleteShooppingCart(int GouCarId) { string strMsg = "fail"; B_ShoppingList WarHouser = (from tbShopping in myModels.B_ShoppingList where tbShopping.ShoppingID == GouCarId select tbShopping).Single(); myModels.B_ShoppingList.Remove(WarHouser); myModels.SaveChanges(); strMsg = "success"; return(Json(strMsg, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 加入购物车 /// </summary> /// <returns></returns> public ActionResult AddGouCatr(B_ShoppingList DuDao) { string StrinM = "fail"; B_ShoppingList KK = new B_ShoppingList(); KK.UnameID = DuDao.UnameID; KK.GoodsListedDetailID = DuDao.GoodsListedDetailID; KK.Money = DuDao.Money; KK.BitColer = DuDao.BitColer; KK.MumberOfPackages = DuDao.MumberOfPackages; if (KK.UnameID != null && KK.GoodsListedDetailID != null && KK.Money != null && KK.BitColer != null) { myModels.B_ShoppingList.Add(KK); myModels.SaveChanges(); StrinM = "success"; return(Json(StrinM, JsonRequestBehavior.AllowGet)); } return(Json(StrinM, JsonRequestBehavior.AllowGet)); }