// GET: CheckOut /// <summary> /// 確認購物車 /// </summary> /// <returns></returns> public ActionResult Index(int Order_Quantity, string Book_ID2) { string Customer_Email = ""; try { Customer_Email = Request.Cookies["cookie"]["Account"].ToString(); }catch (Exception e) { return(RedirectToAction("RedirectToLogin", "Login")); } Service.SQLGetShoppingCart SCO = new Service.SQLGetShoppingCart(); List <Model.ShippingCar> Data = new List <Model.ShippingCar>(); Data = SCO.Find(Customer_Email); try { int book = int.Parse(Book_ID2); Data[book].Order_Quantity = Order_Quantity; }catch (Exception e) { Data[book].Order_Quantity = Order_Quantity; } ViewBag.result = Data; if (Data.Count == 0) { return(RedirectToAction("NonBook", "CheckOut")); } else { return(View()); } }
public ActionResult Insert(Model.CustomerOrder Data, string Order_ID) { Service.SQLCheckOut SCO = new Service.SQLCheckOut(); Data.Customer_Email = Request.Cookies["cookie"]["Account"].ToString(); SCO.InsertCustomer_Order(Data); Service.SQLGetShoppingCart SGSC = new Service.SQLGetShoppingCart(); List <Model.ShippingCar> Data2 = new List <Model.ShippingCar>(); Data2 = SGSC.Find(Data.Customer_Email); SCO.InsertOrder_Books(Data, Data2); Service.SQLDeleteShoppingCart SDSC = new Service.SQLDeleteShoppingCart(); SDSC.Delete_Cart(); return(RedirectToAction("Index", "DataShow", new { Order_ID = Order_ID })); }