I have a stored procedure which used for my shopping cart system which returns the total amount and looks like this;
ALTER PROCEDURE [dbo].[ShoppingCartGetTotalAmount]
(@CartID char(36))
AS
SELECT ISNULL(SUM(Product.Price * ShoppingCart.Quantity), 0)
FROM ShoppingCart INNER JOIN Product
ON ShoppingCart.ProductID = Product.ProductID
WHERE ShoppingCart.CartID = @CartID
However, Now I want to do the same thing in Entity Framework. Therefore, I need to know either of the following options;
1) How can I do the above task in Entity FrameWork i-e
SELECT ISNULL(SUM(Product.Price * ShoppingCart.Quantity), 0)
FROM ShoppingCart INNER JOIN Product
ON ShoppingCart.ProductID = Product.ProductID
WHERE ShoppingCart.CartID = @CartID
2) Or What is the Equavilant to the SQL ISNULL() function in C#?
3) Or How can I achieve this -> ISNULL(SUM(Product.Price * ShoppingCart.Quantity), 0)
using any .Net method?