Beispiel #1
0
        public ActionResult CanelOrder(int Id)
        {
            BuyItemDetailEntify be = new BuyItemDetailEntify();

            ViewBag.Pid = Id;
            return(View(be.Query(Id).ToList()));
        }
Beispiel #2
0
        public ActionResult Index(OrderViewModel orderView)
        {
            if (ModelState.IsValid)
            {
                var userId = HttpContext.User.Identity.GetUserId();

                var             currentCart = Models.Cart.Operation.GetCurrentCart();
                List <CartItem> items       = currentCart.GetCartItems();

                Decimal totalPrice;
                totalPrice = currentCart.TotalAmount;

                //0 現金
                //1 信用卡
                PaymentEntity pe = new PaymentEntity();
                int           payId;
                payId = pe.Insert(orderView, userId, totalPrice, 1);

                BuyItemDetailEntify be = new BuyItemDetailEntify();
                Boolean             isInserted;
                isInserted = be.Insert(items, userId, payId);

                TFDBLibrary.TakeFiveDBEntities db = new TFDBLibrary.TakeFiveDBEntities();

                foreach (var item in items)
                {
                    db.producttbl.Find(item.Id).state += 1;
                }
                db.SaveChanges();

                //移除購物車Session資料
                HttpContext.Session.Remove("Cart");

                //轉至訂單完成頁面
                return(RedirectToAction("FinishOrdered"));

                //string msg;
                //msg=PrintOrderViewContent(orderView);
                //return Content(msg);
            }
            // todo error page
            return(Content("Error!"));
            //return View();
        }
Beispiel #3
0
        public ActionResult MyOrderDetail(int Id)
        {
            BuyItemDetailEntify be = new BuyItemDetailEntify();

            return(View(be.Query(Id).ToList()));
        }