我用这个:
.DataSource(dataSource = > dataSource.Ajax()
.Aggregates(aggregates = > {
aggregates.Add(p = > p.UnitsInStock).Min().Max().Count();
aggregates.Add(p = > p.UnitsOnOrder).Average();
aggregates.Add(p = > p.ProductName).Count();
aggregates.Add(p = > p.UnitPrice).Sum();
})
.Group(groups = > groups.Add(p = > p.UnitsInStock))
.Read(read = > read.Action("Aggregates_Read", "Grid"))
现在我想计算没有<0的价格和背景不透明(没有颜色)的UnitPrice的总和;我把代码写下来了,但它是错误的。
.DataSource(dataSource = > dataSource.Ajax()
.Aggregates(aggregates = > {
aggregates.Add(p = > p.UnitsInStock).Min().Max().Count();
aggregates.Add(p = > p.UnitsOnOrder).Average();
aggregates.Add(p = > p.ProductName).Count();
aggregates.Add(p = > p.UnitPrice)
.Sum(p.UnitPrice > 0 && p.background == transparent);
})
.Group(groups = > groups.Add(p = > p.UnitsInStock))
.Read(read = > read.Action("Aggregates_Read", "Grid"))