public ActionResult Purchase()
        {
            BuyerOrdersClient BOC = new BuyerOrdersClient();

            ViewBag.OrdersList = BOC.findAll(Convert.ToInt32(Session["userID"]));
            return(View());
        }
        public ActionResult Checkout(string shop_List, string delivery_List)
        {
            int address_ID = Convert.ToInt32(Session["Address_ID"].ToString());
            var check      = CheckAvailableItems();

            if (check == null)
            {
                var shop     = shop_List.TrimEnd().Split(' ');
                var delivery = delivery_List.TrimEnd().Split(' ');

                var shopAndDelivery = shop.Zip(delivery, (s, d) => new { Shop = s, Delivery = d });

                UserCartClient UC         = new UserCartClient();
                var            cart_Items = UC.LoadCart(Convert.ToInt32(Session["userID"]));

                foreach (var i in shopAndDelivery)
                {
                    BuyerOrders buyerOrders = new BuyerOrders();
                    string      uniqueID    = GenerateOrderID();
                    buyerOrders.Order_ID     = uniqueID;
                    buyerOrders.User_ID      = Convert.ToInt32(Session["userID"]);
                    buyerOrders.Store_ID     = Convert.ToInt32(i.Shop);
                    buyerOrders.delivery     = Convert.ToInt32(i.Delivery);
                    buyerOrders.payment      = Session["payment"].ToString();
                    buyerOrders.created_date = DateTime.Now;
                    buyerOrders.decription   = "";
                    buyerOrders.status       = 1;
                    buyerOrders.Address_ID   = address_ID;
                    buyerOrders.Total_Order  = 0;
                    BuyerOrdersViewModel bovm = new BuyerOrdersViewModel();
                    bovm.buyerOrders = buyerOrders;
                    BuyerOrdersClient BOC = new BuyerOrdersClient();
                    BOC.Create(bovm.buyerOrders);

                    foreach (var item in cart_Items)
                    {
                        if (item.Store_ID == Convert.ToInt32(i.Shop))
                        {
                            BuyerOrderItems orderItems = new BuyerOrderItems();
                            orderItems.Order_ID = uniqueID;
                            orderItems.Item_ID  = item.ItemID;
                            orderItems.price    = item.Price;
                            orderItems.quantity = item.Quantity;
                            orderItems.discount = 0;
                            orderItems.total    = item.Price * item.Quantity + orderItems.discount;
                            orderItems.status   = 1;
                            BuyerOrderItemsViewModel boivm = new BuyerOrderItemsViewModel();
                            boivm.orderItems = orderItems;
                            BuyerOrderItemsClient BOIC = new BuyerOrderItemsClient();
                            BOIC.Create(boivm.orderItems);
                        }
                    }
                }

                return(Content("Success!!!"));
            }
            return(Content("out of order"));
        }