Exemplo n.º 1
0
        public ActionResult ReturnDVD(int id)
        {
            var manager = new Manager();
            var dvd = manager.GetDVDById(id);

            return View(dvd);
        }
Exemplo n.º 2
0
        public void AddDVDTest()
        {
            var manager = new Manager();

            var _dvds = manager.GetAllDVDs();

            int count = _dvds.Count();

            var dvd = new DVD
            {

                Title = "Test",
                Director = "Test",
                Studio = "Test",
                Rating = MPAARating.NR,
                Status = LendingStatus.InStock,
                //Genre = Genres.Action,
                UserRating = 4,
                //ReleaseDate = DateTime.Parse("10-10-2010"),
                Actors =
                {

                },

            };

            manager.AddDVD(dvd);

            bool result = (_dvds.Count() == count + 1);

            Assert.IsTrue(result);
        }
Exemplo n.º 3
0
        public ActionResult DeleteDVD(DVD dvd)
        {
            var manager = new Manager();
            manager.DeleteDVD(dvd.Id);

            return RedirectToAction("Index", "Home");
        }
Exemplo n.º 4
0
 public ActionResult AddDVD(DVD dvd)
 {
     var manager = new Manager();
     manager.AddDVD(dvd);
     dvd.CheckOutDate = DateTime.Now;
     dvd.Status = LendingStatus.CheckedOut;
     return RedirectToAction("Index", "Home");
 }
Exemplo n.º 5
0
        public void DeleteDVDTest()
        {
            var manager = new Manager();
            var _dvds = manager.GetAllDVDs();
            int count = _dvds.Count();
            var dvd1 = _dvds.FirstOrDefault(d => d.Id == 1);
            var dvd2 = _dvds.FirstOrDefault(d => d.Id == 2);
            manager.DeleteDVD(dvd2.Id);
            manager.DeleteDVD(dvd1.Id);

            bool result = (_dvds.Count == count - 2);

            Assert.IsTrue(result);
        }
Exemplo n.º 6
0
        public ActionResult ReturnDVD(DVD dvd)
        {
            var manager = new Manager();
            dvd.ReturnDate = DateTime.Now;
            dvd.Status = LendingStatus.InStock;

            manager.ReturnDVD(dvd);

            return RedirectToAction("Index", "Home");
        }
Exemplo n.º 7
0
        public ActionResult SearchDVD(string searchInput)
        {
            if (searchInput != null)
            {
                var manager = new Manager();
                var dvd = manager.GetDVDByName(searchInput.ToLower());

                return View(dvd);
            }

            return RedirectToAction("Index", "Home");
        }
Exemplo n.º 8
0
 public DVD Get(int id)
 {
     var manager = new Manager();
     return manager.GetDVDById(id);
 }
Exemplo n.º 9
0
        public List<DVD> Get()
        {
            var manager = new Manager();

            return manager.GetAllDVDs();
        }