Hi,
- I have a table 'Menus' containing the names of the menus of the restaurant.
- I also have a table 'Ingredients' containing the ingredients that are available to the menus.
I don't have any trouble getting the values out of the 'Menus' table into an IQueryable class (PropAllMenus)
Public Class PropAllMenus
Private _MenuID As Integer
Public Property MenuID() As Integer
Get
Return _MenuID
End Get
Set(ByVal value As Integer)
_MenuID = value
End Set
End Property
Private _Name As String
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Private _DaypartID As Integer
Public Property DaypartID() As Integer
Get
Return _DaypartID
End Get
Set(ByVal value As Integer)
_DaypartID = value
End Set
End Property
I just use this code in the DBRepository class
Public Function ListAllMenus() As IQueryable(Of PropAllMenus) Implements IDBRepository.ListAllMenus
Dim result = From p In _db.Menus Select New PropAllMenus With {.MenuID = p.MenuID, .Name = p.Name}
Return result
End Function
This works fine.
- Now, i also have a many to many table 'MenuIngredients' containing the Id's of ingredients that belong to a menu.
However, i don't know what steps i should take to:
- Query the DB with a LINQ query to get a LIST of MENU NAMES with all their INGREDIENTS
- fill up a new IQuerable(of...) class so i can pass it to my view
I tried using a property of type array (that contained the ingredients of a menu) but that didn't seem to work.