public ActionResult AddToTheatre(AddToTheatre model) { var theatre = db.Theatres.Find(model.selectedTheatre); var play = db.Plays.Find(model.selectedPlay); theatre.Plays.Add(play); db.SaveChanges(); return(RedirectToAction("Index", "Theatres")); }
public ActionResult AddToTheatre(int id) { var model = new AddToTheatre(); model.selectedTheatre = id; model.Plays = db.Plays.ToList(); var theatre = db.Theatres.Find(model.selectedTheatre); ViewBag.TheatreName = theatre.Name; return(View(model)); }