I have 3 collections: dealerships, brands, and models. I'm trying to pass a dealershipID to a controller, then for each brand having the dealershipID , loop through the models. My context is carcontext.
I can see how to pass the dealershipID using actionresult( int id) and then use the .include find. I'm getting lost after that. I'm concerned that my find will only return a single brand not a collection.
So in psudeo code:
Select brands from carecontext where lot contains dealershipID
@foreach (var bitem = vmodel.brand)
if modelID is notnull -----check for at least one model
(
@foreach (var mitem = vmodel.model)
{ create a bitmap image } -I can create the image
assign bitmap to array
}
pass array in returnview()
where the same context will build a table to display the brand information and include the image as part of the table.
I need help in the mvc4 syntax of the pseudo code, creating and assigning the array and the syntax to pass it in the returnview().
I'm using Contoso and music store as guides. Any other tutorial suggestions??
A newbie getting lost in syntax and muddling through (too many) new concepts lazy loading, lambda, methods.
Many thanks for the help.