I keep getting an error code for line 27 and 37. I copied this
directly from the book and even downloaded the source code and still
come up with these 2 errors in Chapter 7
Error 1 'items' is not a member of 'ShoppingCart'.
C:\Websites\PPQ\skeleton\App_Code\StoredShoppingCa rt.
vb 27
16 C:\...\skeleton\
Error 2 Argument not specified for parameter 'ItemPrice'
of 'Public Sub Update(MenuItemID As Integer, ItemSize As String,
itemName As String, ItemPrice As Decimal, Quantity As Integer)'.
C:\Websites\PPQ\skeleton\App_Code\StoredShoppingCa rt.
vb 37
9 C:\...\skeleton\
Here is my code below:
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Public Class StoredShoppingCart
Public Shared Function Read() As ShoppingCart
Return FetchCart()
End Function
Public Shared Function Update(ByVal DeliveryCharge As Decimal) As Integer
Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()
cart.DeliveryCharge = DeliveryCharge
End Function
Public Shared Function ReadItems() As List(Of CartItem)
Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()
Return cart.items (THIS IS LINE 27)
End Function
Public Shared Function UpdateItem(ByVal MenuItemID As Integer, ByVal ItemSize As String, ByVal Quantity As Integer) As Integer
Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()
cart.Update(MenuItemID, ItemSize, Quantity) (THIS IS LINE 37)
End Function
Public Shared Function DeleteItem(ByVal MenuItemID As Integer, ByVal ItemSize As String) As Integer
Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()
cart.Delete(MenuItemID, ItemSize)
End Function
Public Shared Function InsertItem(ByVal MenuItemID As Integer, ByVal ItemName As String, ByVal ItemSize As String, ByVal Quantity As Integer, ByVal ItemPrice As Decimal) As Integer
Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()
cart.Insert(MenuItemID, ItemSize, ItemName, ItemPrice, Quantity)
End Function
Private Shared Function FetchCart() As ShoppingCart
Dim cart As ShoppingCart = _
DirectCast(HttpContext.Current.Session("Cart"), ShoppingCart)
If cart Is Nothing Then
cart = New ShoppingCart()
HttpContext.Current.Session("Cart") = cart
End If
Return cart
End Function
End Class