public ActionResult Create(CreateTVShowModel model) { if (ModelState.IsValid) { model = modelHandler.convertToGenres(model); db.tvshows.Add(model.TVShow); db.SaveChanges(); return RedirectToAction("Index"); } return View(); }
public ActionResult Edit(CreateTVShowModel model) { if (ModelState.IsValid) { modelHandler.updateGenres(model); // Updates the changes and pushes it to the database. return RedirectToAction("Index"); } return View(model.TVShow); }
// GET: tvshows/Create public ActionResult Create() { CreateTVShowModel model = new CreateTVShowModel(); model = modelHandler.createGenreOptions(model); return View(model); }
// GET: tvshows/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } tvshow tvshow = db.tvshows.Find(id); if (tvshow == null) { return HttpNotFound(); } CreateTVShowModel model = new CreateTVShowModel(); model.TVShow = tvshow; model = modelHandler.createGenreOptions(model); return View(model); }