public void DeleteItem(int itemId)
        {
            var itemDb = new ItemDb();
            var orderC = new OrderCtrl();

            orderC.DeleteOrderLineItem(itemId);
            //  itemDb.DeleteItem(itemId);
        }
Example #2
0
        public List <DatabaseAccessLibrary.Order> GetOrdersByCustomerId(int id)
        {
            var cusDb        = new CustomerDb();
            var ordC         = new OrderCtrl();
            var orderHistory = cusDb.GetOrderHistoryByCustomerId(id);

            orderHistory.ForEach(x => x.OrderLineItems.AddRange(ordC.GetOrderLineItemsById(x.id)));
            return(orderHistory);
        }
        public IEnumerable <ModelLibrary.Order> GetAllOrdersByRestaurant(int restaurantId)
        {
            var orderDb   = new OrderDb();
            var orderCtrl = new OrderCtrl();
            var dbOrders  = orderDb.GetAllRestaurantOrders(restaurantId);
            var orderList = new List <ModelLibrary.Order>();

            foreach (var order in dbOrders)
            {
                var modelOrderList = orderCtrl.ConvertOrderToModel(order);
                orderList.Add(modelOrderList);
            }
            return(orderList);
        }
Example #4
0
        private int CreateNewOrder(int resId, int noSeats, DateTime date)
        {
            OrderCtrl orderCtrl = new OrderCtrl();
            DateTime  now       = DateTime.Now;
            string    nowDate   = now.Year + "-" + now.Month + "-" + now.Day + " " + now.Hour +
                                  ":" + now.Minute + ":" + now.Second + "." + now.Millisecond;

            string dateTime = date.Year + "-" + date.Month + "-" + date.Day + " " + date.Hour +
                              ":" + date.Minute + ":" + date.Second + "." + date.Millisecond;

            var order = new ModelLibrary.Order
            {
                RestaurantId        = Convert.ToString(resId),
                DateTime            = Convert.ToString(now),
                ReservationDateTime = dateTime,
                //DateTime = nowDate,
                //ReservationDateTime = dateTime,
                NoSeats  = Convert.ToString(noSeats),
                Accepted = false
            };

            return(orderCtrl.AddOrder(order));
        }