I have a somewhat complex model that I need to pass to a MVC 2 Create view so its properties can be filled out. I'm not sure how to actually create this model as it has some relationship data that must also be filled out during the creation process.
My main model is a Game. Most of its properties are scalar. It contains a foreign key to Content, for the game reviews, and there's a many-to-many relationship between Games and Platforms - games can be on a variety of platforms (PS3, XBox 360, etc.), and each platform has a library of games.
When I pass data to my Edit view, it's as simple as:
var model = _siteDB.Games.Include("Content").Include("Platforms").Single(g => g.GameID == id);
I'm unsure what to do in the case of Create as I'm not sure how to link the associated parts - Content and Platforms - to a Game object.
View Complete Post