Пример #1
0
        public OrderErrorCodes AddToOrder(int dishNumber, int tableNumber)
        {
            var dish = dishManager.GetDishByDishNumber(dishNumber);

            if (dish == null)
            {
                return(OrderErrorCodes.NoSuchDish);
            }
            var table = tableManager.GetTableByTableNumber(tableNumber);

            if (table == null)
            {
                return(OrderErrorCodes.NoSuchTable);
            }
            var order = orderManager.GetActiveOrder(table.TableID);

            if (order == null)
            {
                order = orderManager.CreateActiveOrder(table.TableID);
            }
            orderManager.AddToOrder(order.OrderID, dish.DishID);
            return(OrderErrorCodes.Ok);
        }