예제 #1
0
        public ActionResult AddressAndPayMent(FormCollection values)
        {
            var order = new musicorder();

            TryUpdateModel(order);
            try
            {
                if (string.Equals(values["PromoCode"], PromoCode, StringComparison.OrdinalIgnoreCase) == false)
                {
                    return(View(order));
                }
                else
                {
                    order.Username  = User.Identity.Name;
                    order.OrderDate = DateTime.Now;
                    //保存订单
                    Maticsoft.BLL.musicorder orderbll = new Maticsoft.BLL.musicorder();
                    if (orderbll.Add(order))
                    {
                        int orderid = orderbll.GetMaxId() - 1;
                        var cart    = ShoppingCart.GetCart(this.HttpContext);
                        order.OrderId = orderid;
                        cart.CreateOrder(order);
                    }

                    return(RedirectToAction("Complete", new { id = order.OrderId }));
                }
            }
            catch (Exception e)
            {
                return(View(e));
            }
        }
예제 #2
0
        public ActionResult Complete(int id)
        {
            bool isValid = true;

            Maticsoft.BLL.musicorder orderbll = new Maticsoft.BLL.musicorder();
            isValid = orderbll.Exists(id);
            if (isValid)
            {
                return(View(id));
            }
            else
            {
                return(View("Error"));
            }
        }