예제 #1
0
 public List <SpecialEvent> SpecialEvent_List()
 {
     //interfacing with our Context class which is inherites DBContext which ties into entity framework
     using (eResturantContext context = new eResturantContext())
     {
         return(context.SpecialEvents.ToList());
     }
 }
예제 #2
0
        public List <MenuCategoryFoodItems> MenuCategoryFoodItems_Get()
        {
            using (var context = new eResturantContext())
            {
                var results = from food in context.Items
                              orderby food.MenuCategory.Description
                              select new MenuCategoryFoodItems
                {
                    MenuCategoryDescription = food.MenuCategory.Description
                    , ItemID          = food.ItemID
                    , FoodDescription = food.Description
                    , CurrentPrice    = food.CurrentPrice
                    , TimesServed     = food.BillItems.Count()
                };


                return(results.ToList());
            }
        }
예제 #3
0
        public List <MenuCategoryFoodItemsDTO> MenuCategoryFoodItemsDTO_Get()
        {
            using (var context = new eResturantContext())
            {
                var results = from food in context.Items
                              group food by new { food.MenuCategory.Description } into tempdataset
                    select new MenuCategoryFoodItemsDTO
                {
                    MenuCategoryDescription = tempdataset.Key.Description
                    ,
                    FoodItems = (from a in tempdataset
                                 select new FoodItemCounts
                    {
                        ItemID = a.ItemID
                        , FoodDescription = a.Description
                        , CurrentPrice = a.CurrentPrice
                        , TimesServed = a.BillItems.Count()
                    }
                                 ).ToList()
                };

                return(results.ToList());
            }
        }