This project is read-only.

A question in ShoppingCartModel.AddToCart

Dec 28, 2010 at 4:57 AM

I'm sorry I am new, but I have a lot of question. :)

var cartItem = storeDB.Carts.SingleOrDefault(
    c => c.CartId == shoppingCartId &&
    c.AlbumId == album.AlbumId);

Could you explain that why use SingleOrDefault not Single?

according to the underside: if (cartItem == null) so it also maybe return null while we use the "Default"?