예제 #1
0
        public ActionResult Checkout(Order order, Address BillingAddress, Address ShippingAddress, String cartdata)
        {
            if (cartdata == null || cartdata.Length == 0)
            {
                ViewBag.Message = "You must have at least one item to checkout.";
                return(View("Error"));
            }
            order.Stores         = null;
            order.BillingAddress = BillingAddress;
            if (order.IsUsedAsShipping == false)
            {
                order.ShippingAddress = ShippingAddress;
            }
            string[]            itemsArray = cartdata.Split(',');
            List <ProductOrder> cartList   = new List <ProductOrder>();
            ProductOrder        orderItem  = null;

            foreach (var item in itemsArray)
            {
                string[] itemDict = item.Split(':');
                orderItem           = new ProductOrder();
                orderItem.ProductId = Int32.Parse(itemDict[0]);
                orderItem.Quantity  = Int32.Parse(itemDict[1]);
                cartList.Add(orderItem);
            }

            order.OrderDate = DateTime.Now;

            Order_Logic.AddOrder(order, cartList);

            return(View(order));
        }
예제 #2
0
        public ActionResult UserManage()
        {
            var userid = (from _user in db.UserProfiles
                          where _user.UserName == User.Identity.Name
                          select _user.UserId).FirstOrDefault();
            UserProfile user = db.UserProfiles.Find(userid);

            if (user == null)
            {
                return(HttpNotFound());
            }
            List <Order> list = Order_Logic.GetListByUserID(userid, 2);

            return(View(list));
        }
예제 #3
0
 public ActionResult UpdateOrderStatus(int ID, int StatusID)
 {
     return(Json(Order_Logic.UpdateStatusOrder(ID, StatusID), JsonRequestBehavior.AllowGet));
 }