Example #1
0
        static void InitShows()
        {
            Show show = new Show {
                Name          = "Breaking Bad"
                , Description = "Informed he has terminal cancer, an underachieving chemistry genius " +
                                "turned high school chemistry teacher turns to using his expertise in " +
                                "chemistry to provide a legacy for his family..." +
                                " by producing the world's highest quality crystal meth."
            };
            Season season = new Season
            {
                Number   = 1
                , Name   = "1"
                , Debut  = new DateTime(2008, 1, 28)
                , Finale = new DateTime(2008, 3, 10)
            };
            Episode episode = new Episode
            {
                Title      = "Pilot"
                , Duration = 40
                , Synopsis =
                    "Walter White, a 50-year old chemistry teacher, secretly begins making crystal methamphetamine"
                    + " to support his family when he finds out that he has terminal lung cancer. He teams up with a former student,"
                    + " Jesse Pinkman, who is a meth dealer. Jesse is trying to sell the meth but the dealers snatch him and make him"
                    + " show them the lab. Walter knows they intend to kill him so he poisons them while showing them his recipe."
                , Score = 4
            };

            ShowService.AddShow(show);
            ShowService.AddSeasonToShow(show.Name, season);
            ShowService.AddEpisodeToSeason(show.Name, 1, episode);
        }
Example #2
0
        public ActionResult CreateSeason(SeasonModel model)
        {
            if (ModelState.IsValid)
            {
                Show showObj = Service.GetShowByName(model.ShowName);
                if (showObj == null)
                {
                    ModelState.AddModelError("ShowName", "Show does not exist");
                    return(View(model));
                }
                Season season = Service.GetSeason(showObj.Name, model.Number);
                if (season == null)
                {
                    season = new Season {
                        Name = model.Name, Number = model.Number, Debut = model.Debut, Finale = model.Finale
                    };
                    Service.AddSeasonToShow(showObj.Name, season);
                    return(RedirectToAction("Index"));
                }
            }

            return(View(model));
        }