예제 #1
0
        public ActionResult Create(CreateTVShowModel model)
        {
            if (ModelState.IsValid)
            {
                model = modelHandler.convertToGenres(model);

                db.tvshows.Add(model.TVShow);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View();
        }
예제 #2
0
        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);
        }
예제 #3
0
 // GET: tvshows/Create
 public ActionResult Create()
 {
     CreateTVShowModel model = new CreateTVShowModel();
     model = modelHandler.createGenreOptions(model);
     return View(model);
 }
예제 #4
0
        // 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);
        }