1
foreach (lc_ShoppingCart sc in shQuery)
{
//Decrement the Product Table's Total Remaining row with the quantity
var ProductInventoryQuery = (from pr in db.lc_ProductInventories
join c in db.lc_ColorTables on pr.Color equals c.Color
join s in db.lc_SizeTables on pr.Size equals s.Size
where pr.ProductID == Convert.ToInt32(sc.ProductID)
where pr.Color == c.Color
where pr.Size == s.Size
select pr).First();
ProductInventoryQuery.Quantity = ProductInventoryQuery.Quantity - sc.Quantity;
}
使用LinqPad http://www.linqpad.net/ – 2011-03-23 09:54:18