位置:海鸟网 > IT > ASP.NET >

Linq查询

 public List<JMIntegral.DBUtility.BBCustomer> GetList(string name, string product)
        {
                     var table = from c in _db.BBCustomer
                        where (!string.IsNullOrEmpty(name) ? c.Name.Contains(name) : true) &&
                            (!string.IsNullOrEmpty(product) ? c.ProductName.Contains(product) : true)
                        orderby c.CID descending
                        select c;
            return table.ToList();
        }