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

            return(query);
        }
Esempio n. 2
0
        public IQueryable <Product> GetProducts([QueryString("id")] int?categoryId)
        {
            var _db = new Webb3.Models.ProductContext();
            IQueryable <Product> query = _db.Products;

            if (categoryId.HasValue && categoryId > 0)
            {
                query = query.Where(p => p.CategoryID == categoryId);
            }
            return(query);
        }
Esempio n. 3
0
        public IQueryable <Product> GetProduct([QueryString("productID")] int?productId)
        {
            var _db = new Webb3.Models.ProductContext();
            IQueryable <Product> query = _db.Products;

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