public int checkout(ShoppingCart cart)
        {
            var db = new DatabaseContext();

            var newOrder = new Orders()
            {
                OrderDate = DateTime.Now, 
                CustomersId = cart.userID
            };
            db.Orders.Add(newOrder);
            db.SaveChanges();
            

            foreach (var item in cart.shoppingCartItems)
            {
                var newItem = new OrderLines()
                {
                    ProductsId = item.product.itemnumber,
                    OrdersId = newOrder.Id,
                    Quantity = item.quantity
                };
                db.OrderLines.Add(newItem);
            }
            db.SaveChanges();

            return newOrder.Id;
        }
        private BillingDocument showOrder(Order id)
        {
  
            var orderDB = new DBOrder();
            List<OrderLine> list = orderDB.getOrder(id.id);
            List<ShoppingCartItem> cartItems = new List<ShoppingCartItem>();
            var cartSum = 0;
            foreach(var item in list){
                cartItems.Add(new ShoppingCartItem(item.product, item.quantity));
                cartSum += item.product.price * item.quantity;
            };
            var cart = new ShoppingCart(id.customerid)
            {
                shoppingCartItems = cartItems,
                sum = cartSum
            };
            var billingDoc = new BillingDocument(){
                order = id,
                customer = (Customer) Session["LoggedInUser"],
                shoppingcart = cart,
                sum = cart.sum, 
                exmva = cart.sum * 0.8,
                mva = cart.sum * 0.2

            };
            return billingDoc;
        }