public ActionResult RemoveDVD(int id) { var repo = new DVDRepo(); repo.RemoveDVD(id); return(View("SuccessPage")); }
public void RemoveDVDProduction() { var repo = new DVDRepo(); repo.RemoveDVD(20); //change depending on your database //Assert.AreEqual(true, true); }
public IHttpActionResult GetAllByTitle(string title) { List <DVD> found = DVDRepo.GetAllByTitle(title); if (found == null) { return(NotFound()); } return(Ok(found)); }
public IHttpActionResult GetAllByRating(string rating) { List <DVD> found = DVDRepo.GetAllByRating(rating); if (found == null) { return(NotFound()); } return(Ok(found)); }
public IHttpActionResult GetAllByYear(string releaseYear) { List <DVD> found = DVDRepo.GetAllByYear(releaseYear); if (found == null) { return(NotFound()); } return(Ok(found)); }
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)); }
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)); }
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)); }
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)); }
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); }
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)); }
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)); } }
public void Delete(int id) { DVDRepo.Delete(id); }
public void Edit(int id, DVD dvd) { DVDRepo.Update(dvd); }
public IHttpActionResult Add(DVD dvd) { DVDRepo.Create(dvd); return(Created($"/dvd{dvd.MovieId}", dvd)); }
public IHttpActionResult Get(int id) { return(Ok(DVDRepo.Get(id))); }
public IHttpActionResult GetAllByDirector(string director) { return(Ok(DVDRepo.GetAllByDirector(director))); }
public IHttpActionResult GetAll() { return(Ok(DVDRepo.GetAll())); }