public ActionResult deliver(food f, int code)
        {
            if (Session["nav"] == null)
            {
                return(View("Login"));
            }
            resturantEntities   re = new resturantEntities();
            IQueryable <orders> or = from o in re.orders select o;
            orders order           = new orders();

            order.code           = or.First().code - 1;
            order.delivery_code  = 1;
            order.orders_time    = DateTime.Now;
            order.recieved_time  = DateTime.Now;
            order.price          = f.price * 1000;
            order.delivery_price = 1000;
            re.orders.Add(order);
            re.SaveChanges();

            ordering orderings = new ordering();

            orderings.costumer   = ((mambership)Session["nav"]).username;
            orderings.order_code = order.code;
            orderings.food       = f.code;
            orderings.rcode      = int.Parse(Session["now"].ToString());
            re.ordering.Add(orderings);
            re.SaveChanges();

            return(View());
        }
        public MainWindow()
        {
            orders = new ordering();

            try
            {
                InitializeComponent();

                chefsList.Add(new Chef() { cookID = 1, name = "billy bob" }); //hard coded a chef for now.

                //console.writeline("right before getactiveorders is called." + environment.newline);

                GetActiveOrders();  //needs to update everytime an order is added

                //console.writeline("right after getactiveorders is called." + environment.newline);


                //Needs to be scaled to EVERY ORDER
                MenuDirectEntities db = new MenuDirectEntities();

                //int num = chefsList.ElementAt(0).orders.ElementAt(0);

                List<int> IDList = getOrderListID(curChef);

                for (int i = 0; i < 1; i++)
                {
                    int num = IDList.ElementAt(i);

                    var prodIDs = (from ol in db.orderLists
                                   where ol.orderNumber == num
                                   select ol.prodID);

                    displayed = (from ol in db.products
                                 select ol).ToList<product>();

                    List<string> displayedLis = (from ol in displayed
                                     join prod in prodIDs on ol.prodID equals prod
                                     select ol.prodName).ToList<string>();

                    dataGrid1.ItemsSource = displayedLis;
                }

                //listBox1
                //listBox1.ItemsSource = displayed;
            }

            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public ActionResult getOrdering()
        {
            String          sql     = "select * from orderList where orderingState = 'false' ORDER by id";
            DataSet         ds      = dbo.query(sql);
            List <ordering> navList = new List <ordering>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ordering nav = new ordering()
                {
                    id         = (Guid)dr["id"],
                    roomID     = dr["roomID"].ToString(),
                    order      = dr["ordering"].ToString(),
                    orderID    = dr["orderingID"].ToString(),
                    orderState = (Boolean)dr["orderingState"],
                    note       = dr["note"].ToString(),
                    createtime = (DateTime)dr["createtime"],
                    total      = dr["total"].ToString()
                };
                navList.Add(nav);
            }
            return(Json(navList));
        }