zl程序教程

您现在的位置是:首页 >  其它

当前栏目

Linq-多条件查询

查询 条件 LinQ
2023-09-11 14:17:10 时间
这是一个方法,返回IList<AtAGlanceDetail>
public IList<AtAGlanceDetail> GetAtAGlanceReportByCondition(int? supplierId, string container, DateTime? ETA, string FOBPoint, string HBLNum, DateTime? motherVesselETD, string voyage) 
{ 
var data = GetAll().Where(c => c.SupplierId == supplierId && c.Container == container && c.ETA == ETA && c.FOBPoint == FOBPoint && c.HBLNum == HBLNum && c.MotherVesselETD == motherVesselETD && c.Voyage == voyage).AsQueryable(); 
return data.ToList();
}
linq的 多条件拼接 是使用
dataSouce.Where(c => c.SupplierId == supplierId(条件参数) && c.Container == container && c.ETA == ETA ) //这种格式的写法