我有一个简单的疑问
var data = from s in ctx.salesorders
select new
{
ItemID = s.ItemID
Qty = s.Qty
DueDate = s.DueDate
};
我想将截止日期调整两周。鉴于此处无法使用
.AddDays()
,我该怎么做?
var data = from s in ctx.salesorders
select new
{
ItemID = s.ItemID
Qty = s.Qty
DueDate = s.DueDate.AddDays(-14)
};
因为只是一个选择,为什么不这样做呢?
var data = (from s in ctx.salesorders
select new
{
ItemID = s.ItemID
Qty = s.Qty
DueDate = s.DueDate
}).ToList().Select(s=>new
{
ItemID = s.ItemID
Qty = s.Qty
DueDate = s.DueDate.AddDays(-14)
}).ToList();