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

            return(query);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }