Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public ActionResult AddDVD()
        {
            var repo = new DVDRepo();
            var vm = new AddDVDVM();

            vm.CreateActorList(repo.GetAllActors());
            vm.CreateMPAAList(repo.GetAllMPAA());
            vm.CreateStudioList(repo.GetAllStudios());

            return View("AddDVD", vm);
        }
Exemplo n.º 3
0
        public ActionResult GetAllDVDs()
        {
            var repo = new DVDRepo();

            var results = repo.GetAllDVDs();

            ViewBag.Title = "DVDs in Collection";

            if (results.Count == 0)
                return View("NoResults");

            return View("ListDVDsByTitle", results);
        }
Exemplo n.º 4
0
        public ActionResult DVDDetails(int id)
        {
            var vm = new DVDDetailVM();
            var repo = new DVDRepo();
            var results = new List<DVDActorDetail>();
            results = repo.GetActorDetails(id);

            vm.Dvd = repo.GetDVDById(id);
            vm.StudioDescription = repo.GetStudioDescription(vm.Dvd.StudioID);
            vm.ActorNames = repo.GetActorById(results);

            return View(vm);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public ActionResult ListBorrowersByDVD(int id)
        {
            var vm = new DvdBorrowerDetailVM();
            var dvdRepo = new DVDRepo();
            var borrowerRepo = new BorrowerRepo();

            vm.Dvd = dvdRepo.GetDVDById(id);
            vm.BorrowerDetails = borrowerRepo.GetAllBorrowerDetails(id);
            vm.Borrowers = borrowerRepo.GetBorrowerById(vm.BorrowerDetails);

            return View(vm);
        }
Exemplo n.º 7
0
        public ActionResult RemoveDVD(int id)
        {
            var repo = new DVDRepo();

            repo.RemoveDVD(id);

            return View("SuccessPage");
        }
Exemplo n.º 8
0
        public ActionResult ListDVDsByTitle(string title)
        {
            var repo = new DVDRepo();

            var results = repo.GetDVDByTitle(title);
            ViewBag.title = "Search Results";

            if (title == String.Empty)
            {
                return View("EmptySearch");
            }

            if(results.Count == 0)
                return View("NoResults");

            //redirect to List DVDs View
            return View(results);
        }
Exemplo n.º 9
0
        public void RemoveDVDProduction()
        {
            var repo = new DVDRepo();

            repo.RemoveDVD(20);

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