示例#1
0
        public IQueryable <category> GetCategories()
        {
            var _db = new ISD_CW.Models.p_context();
            IQueryable <category> query = _db.Categories;

            return(query);
        }
示例#2
0
        public IQueryable <product> GetProducts([QueryString("id")] int?CategoryID)
        {
            var _db = new ISD_CW.Models.p_context();
            IQueryable <product> query = _db.Products;

            if (CategoryID.HasValue && CategoryID > 0)
            {
                query = query.Where(p => p.CategoryID == CategoryID);
            }
            return(query);
        }
示例#3
0
        //This code shows the GetProducts method which is referenced by the ItemType property of the ListView control
        //in the product_list.aspx page
        public IQueryable <product> GetProduct([QueryString("productID")] int?productId)
        {
            var _db = new ISD_CW.Models.p_context();
            IQueryable <product> query = _db.Products;

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