Exemplo n.º 1
0
        void initDishs()
        {
            DishTypeService typeService = new DishTypeService();
            DishService     dishService = new DishService();
            List <DishType> typeList    = typeService.GetList();
            List <Dish>     allDish     = new List <Dish>();

            foreach (DishType type in typeList)
            {
                List <Dish> dishList = dishService.GetListByTypeId(type.Id);
                if (dishList != null)
                {
                    allDish.AddRange(dishList);
                }
                DishAndTypeList.Add(new DishModel {
                    DishType = type, DishList = dishList
                });
            }
            DishType defautType = new DishType()
            {
                Id = "0", Name = "所有"
            };

            DishAndTypeList.Insert(0, new DishModel()
            {
                DishType = defautType, DishList = allDish
            });
        }