Quick Join to get the weight
-
I have this function that creates an order. I was missing a couple of things in the columns like weight, cost and profit. So I wrote this to just grab the cart items to calculate my missing data List sC = context.ORDERS_CART.Where(m => m.order_ID == pOrderID).ToList(); But then I came to the ship weight, which I need to get from PRODUCT_INFO. I forget the nomemclature for my expression above, so I wasn't able to search possibilities. Possible to do a quick join off sC into another list? If possible, I would need a little nudge towards getting it right. Thanks!
If it ain't broke don't fix it
-
I have this function that creates an order. I was missing a couple of things in the columns like weight, cost and profit. So I wrote this to just grab the cart items to calculate my missing data List sC = context.ORDERS_CART.Where(m => m.order_ID == pOrderID).ToList(); But then I came to the ship weight, which I need to get from PRODUCT_INFO. I forget the nomemclature for my expression above, so I wasn't able to search possibilities. Possible to do a quick join off sC into another list? If possible, I would need a little nudge towards getting it right. Thanks!
If it ain't broke don't fix it
Presumably you have a navigation property from the cart lines to the product info? In which case, you should be able to use something like:
context.ORDERS_CART.Include(l => l.Product).Where(...
which will load the product details with each line. You can then use the navigation property to access the product details for the line.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Presumably you have a navigation property from the cart lines to the product info? In which case, you should be able to use something like:
context.ORDERS_CART.Include(l => l.Product).Where(...
which will load the product details with each line. You can then use the navigation property to access the product details for the line.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer