Exemple #1
0
        public IQueryable <Category> GetCategories()
        {
            var _db = new Foodie.Models.FoodContext();
            IQueryable <Category> query = _db.Categories;

            return(query);
        }
Exemple #2
0
        public IQueryable <Food> GetFoods([QueryString("id")] int?categoryId)
        {
            var _db = new Foodie.Models.FoodContext();
            IQueryable <Food> query = _db.Foods;

            if (categoryId.HasValue && categoryId > 0)
            {
                query = query.Where(f => f.CategoryID == categoryId);
            }
            return(query);
        }
Exemple #3
0
        public IQueryable <Food> GetFood([QueryString("foodID")] int?foodId)
        {
            var _db = new Foodie.Models.FoodContext();
            IQueryable <Food> query = _db.Foods;

            if (foodId.HasValue && foodId > 0)
            {
                query = query.Where(f => f.FoodID == foodId);
            }
            else
            {
                query = null;
            }
            return(query);
        }