예제 #1
0
        public ActionResult RemoveDVD(int id)
        {
            var repo = new DVDRepo();

            repo.RemoveDVD(id);

            return(View("SuccessPage"));
        }
예제 #2
0
        public void RemoveDVDProduction()
        {
            var repo = new DVDRepo();

            repo.RemoveDVD(20);

            //change depending on your database
            //Assert.AreEqual(true, true);
        }
예제 #3
0
        public IHttpActionResult GetAllByTitle(string title)
        {
            List <DVD> found = DVDRepo.GetAllByTitle(title);

            if (found == null)
            {
                return(NotFound());
            }
            return(Ok(found));
        }
예제 #4
0
        public IHttpActionResult GetAllByRating(string rating)
        {
            List <DVD> found = DVDRepo.GetAllByRating(rating);

            if (found == null)
            {
                return(NotFound());
            }
            return(Ok(found));
        }
예제 #5
0
        public IHttpActionResult GetAllByYear(string releaseYear)
        {
            List <DVD> found = DVDRepo.GetAllByYear(releaseYear);

            if (found == null)
            {
                return(NotFound());
            }
            return(Ok(found));
        }
예제 #6
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));
        }
예제 #7
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));
        }
예제 #8
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));
        }
예제 #9
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));
        }
예제 #10
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);
        }
예제 #11
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));
        }
예제 #12
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));
            }
        }
예제 #13
0
 public void Delete(int id)
 {
     DVDRepo.Delete(id);
 }
예제 #14
0
 public void Edit(int id, DVD dvd)
 {
     DVDRepo.Update(dvd);
 }
예제 #15
0
 public IHttpActionResult Add(DVD dvd)
 {
     DVDRepo.Create(dvd);
     return(Created($"/dvd{dvd.MovieId}", dvd));
 }
예제 #16
0
 public IHttpActionResult Get(int id)
 {
     return(Ok(DVDRepo.Get(id)));
 }
예제 #17
0
 public IHttpActionResult GetAllByDirector(string director)
 {
     return(Ok(DVDRepo.GetAllByDirector(director)));
 }
예제 #18
0
 public IHttpActionResult GetAll()
 {
     return(Ok(DVDRepo.GetAll()));
 }