Newbie, working with MVC and Document database. I have a Movies class
public class Movie
{
public string Id { get; set; }
public string MovieName { get; set; }
public DateTime ReleaseDate{ get; set; }
public int NumOfShows { get; set; }
}
Right now I am creating documents in Raven DB, one for each movie. It looks like something like this. It gets updated from a MVC page. I am successfully able to do this now from MVC app to Raven.
{
"MovieName": "Wild wild west",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
But this is not what my goal is. .. My objective is to create one document for one movieTheater with multiple movie informations in it. Something that looks like this...
{
"TheaterId": "Hd45",
"TheaterName" : "Blvd",
{
"MovieName": "Wild wild west",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
{
"MovieName": "Shrek",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
{
"MovieName": "Ronin",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
}
How can I do this..Any help is greatly appreciated. Detailed explanation would be really helpful for my understanding.
Update:
[HttpPost]
public ActionResult Create(TheaterViewModel input)
{
var Theater = new Theater
{
TheaterId = input.Theater.TheaterId,
TheaterName = input.Theater.TheaterName,
// How do I get the Movies nested here, I mean updated
};
_repository.Add(Theater);
_repository.Save();
}