public ActionResult cart(FormCollection collection) { string cosignee = yikuData.UserCurrent.Consignee; if (!string.IsNullOrEmpty(Request.Form["CurrentUser.Consignee"])) cosignee = Request.Form["CurrentUser.Consignee"]; string Address = yikuData.UserCurrent.Address; if (!string.IsNullOrEmpty(Request.Form["CurrentUser.Consignee"])) cosignee = Request.Form["CurrentUser.Consignee"]; CartModels cm = new CartModels(); IQueryable<T_Shopping> TSHS = cm.TSHs; foreach (T_Shopping tsh in TSHS) { Order order = new Order(); order.IID = tsh.IID; order.UID = cm.CurrentUser.UID; order.Count = tsh.Count; order.Cut = tsh.Cut; order.Time = DateTime.Now; order.Cost = tsh.Item.Price * tsh.Count; order.State = "pay"; order.Address = Address; yikuData.Add(order); T_Shopping sss = yikuData.GetT_Shopping(tsh.T_Sh_ID); Item item = yikuData.GetItem(order.IID); item.Volume += order.Count; //商品卖出量增加N份 yikuData.Delete(sss); } yikuData.Save(); return RedirectToAction("trade", "MyYiku"); }
public ActionResult cart() { CartModels cm = new CartModels(); return View(cm); }