Esempio n. 1
0
        public IQueryable <Category> GetCategories()
        {
            var _db = new CampingWorldNew.Models.ProductContext();
            IQueryable <Category> query = _db.Categories;

            return(query);
        }
        public IQueryable <Product> GetProduct([QueryString("productID")] int?productId)
        {
            var _db = new CampingWorldNew.Models.ProductContext();
            IQueryable <Product> query = _db.Products;

            if (productId.HasValue && productId > 0)
            {
                query = query.Where(p => p.ProductID == productId);
            }
            else
            {
                query = null;
            }
            return(query);
        }