예제 #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);
        }
예제 #2
0
        public ActionResult Create(ShowModel model)
        {
            if (ModelState.IsValid)
            {
                Show showObj = Service.GetShowByName(model.Name);
                if (showObj != null)
                {
                    ModelState.AddModelError("Name", "Show Already Exists");
                    return(View(model));
                }
                showObj = new Show {
                    Name = model.Name, Description = model.Description
                };
                Service.AddShow(showObj);
                return(RedirectToAction("Index", new { show = showObj.Name }));
            }

            return(View());
        }
예제 #3
0
        public void AddShow_NotSuccessful_Show_In_The_Past()
        {
            // Arrange
            _showDomainModel = new ShowDomainModel
            {
                ShowTime = DateTime.Now.AddDays(-5)
            };
            string expectedMessage = Messages.SHOW_IN_THE_PAST;

            // Act
            var resultObject = _showService
                               .AddShow(_showDomainModel)
                               .ConfigureAwait(false)
                               .GetAwaiter()
                               .GetResult();

            // Assert
            Assert.IsFalse(resultObject.isSuccessful);
            Assert.AreEqual(expectedMessage, resultObject.ErrorMessage);
        }
예제 #4
0
        public async Task <IActionResult> PostShow(Show show)
        {
            await _service.AddShow(show);

            return(CreatedAtAction("GetShow", new { id = show.Id }, show));
        }
 //添加场次[排场]
 public static int AddShow(int id, string date, string time, string hall)
 {
     return(ShowService.AddShow(id, date, time, hall));
 }