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); }
public static void AddEpisodeToSeason( string showName, int seasonNumber, Episode episode ) { Show show = GetShowByName( showName ); Season seasonObj = show.Seasons.FirstOrDefault(cena => cena.Number == seasonNumber); if ( seasonObj == null ) { throw new ArgumentException( String.Format( "Season {0} does not exist in show {1}", seasonNumber, showName ) ); } seasonObj.Episodes.Add(episode); }
public EpisodeView(string show, Season season, Episode episode) : base("Episode", A(ResolveUri.ForHome(), "Home") , H1(Text("TV Shows")) , H2(Text(show)) , Ul( Li(Text("Season: "), Text(season.Name)) , Li(Text("Title: "), Text(episode.Title)) , Li(Text("Duration: "), Text("" + episode.Duration)) , Li(Text("Synopsis: "), Text(episode.Synopsis)) , Li(Text("Score: "), Text("" + episode.Score)))) { }
public static string ForEpisode(Show show, Season season, Episode episode) { return string.Format("/shows/{0}/{1}/{2}", show, season.Number, episode.Number); }