public ActionResult Create([Bind(Include = "ID,Name")] Genre Genre) { if (ModelState.IsValid) { db.Add <Genre>(Genre); db.SaveChanges(); return(RedirectToAction("Index")); } return(View("Create", Genre)); }
public ActionResult Create([Bind(Include = "ID,GenreID,Name")] Game Game) { if (ModelState.IsValid) { db.Add <Game>(Game); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GenreID = new SelectList(db.Genres, "ID", "Name", Game.GenreID); return(View("Create", Game)); }