Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 // GET: tvshows/Create
 public ActionResult Create()
 {
     CreateTVShowModel model = new CreateTVShowModel();
     model = modelHandler.createGenreOptions(model);
     return View(model);
 }
Exemplo n.º 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);
        }