Пример #1
0
        public ActionResult AddDVD(AddDVDVM vm)
        {
            var repo = new DVDRepo();

            if (ModelState.IsValid)
            {

                int dvdid = repo.AddDVD(vm.DvdToAdd);

                foreach (var actorId in vm.ActorSelectedValues)
                {
                    repo.AddDVDActorDetails(dvdid, actorId);
                }

                return View("SuccessPage");
            }

            else
            {
                vm.CreateActorList(repo.GetAllActors());
                vm.CreateMPAAList(repo.GetAllMPAA());
                vm.CreateStudioList(repo.GetAllStudios());
                return View("AddDVD", vm);
            }
        }
Пример #2
0
        public void AddDVDTestProduction()
        {
            var repo = new DVDRepo();

            var dvd = new DVD()
            {
                Title = "Test",
                ReleaseDate = new DateTime(2015, 10, 19),
                MPAA = "R",
                Director = "Mr. Test",
                StudioID = 1
            };

            int dvdId = repo.AddDVD(dvd);

            //change depending on your database
            Assert.AreEqual(dvdId, 19);
        }