public ActionResult CreateNewUser(User user) { var ops = new DVDLibraryOperations(); ops.CreateUser(user); return RedirectToAction("SelectUserRent"); }
public ActionResult MovieToRepo(AddMovieCarrier newMovie) { var ops = new DVDLibraryOperations(); ops.AddMovie(newMovie); return RedirectToAction("ViewCollection"); }
public void AddMovieToDBTest() { var movie = new AddMovieCarrier(); movie.Title = "Friday"; movie.DateReleased = DateTime.Parse("11/02/1995"); movie.MPAARatingID = "4"; movie.GenreID = "5"; movie.RunTime = "120"; movie.StudioID = "1"; movie.Synopsis = "Two homies, Smokey and Craig, smoke up a dope dealers weed and try to figure a way to get the $200 they owe the dope dealer by 10:00pm that night. In that time they smoke weed, get jacked, and they get shot at in a drive-by."; movie.OwnerRatingID = "5"; movie.Copies = "2"; movie.ImageURL = "http://www.imdb.com/media/rm3404111360/tt0113118?ref_=tt_ov_i"; movie.DirectorID = new List<string>() {"1", "2"}; movie.ActorID = new List<string>() {"1", "2", "3"}; var ops = new DVDLibraryOperations(); ops.AddMovie(movie); var movieAdded = new ViewMovieCarrier(); using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { movieAdded = cn.Query<ViewMovieCarrier>("SELECT * FROM Movies m WHERE m.Title = 'Friday'").FirstOrDefault(); } Assert.AreEqual(movieAdded.Title, movie.Title); }
public ActionResult SelectUserRent() { var ops = new DVDLibraryOperations(); var users = ops.GetUsers().ToList(); var usersVM = new SelectUserViewModel(users); return View(usersVM); }
public ActionResult RentDVD(int movieID) { var userID = (int) Session["User"]; var ops = new DVDLibraryOperations(); ops.RentDVD(movieID, userID); return RedirectToAction("ViewCollection", new {UserID = userID}); }
public ActionResult ReturnMovie(int RentalId) { var ops = new DVDLibraryOperations(); ops.ReturnMovieByRentalID(RentalId); Session["RentalID"] = RentalId; return RedirectToAction("RateMovie"); }
public ActionResult RateMovie(RateMovieCarrier rateMovie) { var ops = new DVDLibraryOperations(); ops.AddUserReview(rateMovie.Rating, rateMovie.MovieID, rateMovie.UserID, rateMovie.Note); var userRentalsVM = new RentalListViewModel(ops.GetUserOutForRent(rateMovie.UserID)); return View("UserRentalList", userRentalsVM); }
public ActionResult RentalHistory() { var ops = new DVDLibraryOperations(); var rentalHistory = ops.GetRentalHistory(); var rentalVM = new RentalHistoryViewModel(rentalHistory); return View(rentalVM); }
public ActionResult DeleteDvD(int MovieID) { //possible undo implementation //Session["DeletedMovie"] = _deleted; _deleted.Push(MovieID); var ops = new DVDLibraryOperations(); ops.DeleteMovie(MovieID); return RedirectToAction("ViewCollection"); }
public HttpResponseMessage Post(ActorModel newActor) { var ops = new DVDLibraryOperations(); ops.AddActor(newActor.FirstName, newActor.LastName); var response = Request.CreateResponse(HttpStatusCode.Created, newActor); string uri = Url.Link("DefaultApi", new { id = newActor.ActorID }); response.Headers.Location = new Uri(uri); return response; }
public ActionResult RateMovie() { int RentalID = (int)Session["RentalID"]; var ops = new DVDLibraryOperations(); var rateMovie = ops.GetRateMovieDetailsByRentalID(RentalID); rateMovie.UserID = (int)Session["userID"]; var rateMovieVM = new RateMovieViewModel(rateMovie); return View(rateMovieVM); }
public ActionResult AddMovie() { var ops = new DVDLibraryOperations(); var mpaa = ops.GetMPAARatings(); var genres = ops.GetGenres(); var directors = ops.GetDirectors().OrderBy(m => m.FirstName).ToList(); var studios = ops.GetStudios().OrderBy(m => m.Name).ToList(); var actors = ops.GetActors().OrderBy(m=>m.FirstName).ToList(); var ratings = ops.GetRatings(); var addMovieVM = new AddMovieViewModel(mpaa, genres, directors, studios, actors, ratings); return View(addMovieVM); }
public void AddUserReviewTests(int Rating, int MovieID, int UserID, string NoteDescription, int noteCountAdder) { var ops = new DVDLibraryOperations(); var ratingCountBefore = 0; var ratingCountAfter = 0; var noteCountBefore = 0; var noteCountAfter = 0; using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { ratingCountBefore = cn.Query<RatingModel>("SELECT * FROM MovieRatings").Count(); noteCountBefore = cn.Query<Note>("SELECT * FROM Notes").Count(); ops.AddUserReview(Rating, MovieID, UserID, NoteDescription); ratingCountAfter = cn.Query<RatingModel>("SELECT * FROM MovieRatings").Count(); noteCountAfter = cn.Query<Note>("SELECT * FROM Notes").Count(); } // Rating count should increase in both cases Assert.AreEqual(ratingCountBefore + 1, ratingCountAfter); // Note count should only increase with a valid note. Assert.AreEqual(noteCountBefore + noteCountAdder, noteCountAfter); }
public ActionResult ViewCollection(string MovieTitle) { var ops = new DVDLibraryOperations(); var movies = ops.GetMovieListShortDetail(); var filteredMovies = (from m in movies where m.Title.ToLower().Contains(MovieTitle.ToLower()) select m).ToList(); var collectionVM = new MovieCollectionViewModel(filteredMovies); return View(collectionVM); }
public List<ActorModel> Get() { var ops = new DVDLibraryOperations(); return ops.GetActors(); }
public ActionResult UserRentalList(int UserID) { Session["userID"] = UserID; var ops = new DVDLibraryOperations(); var userRentalsVM = new RentalListViewModel(ops.GetUserOutForRent(UserID)); return View(userRentalsVM); }
public ActionResult ViewCollection() { var ops = new DVDLibraryOperations(); var movies = ops.GetMovieListShortDetail(); var collectionVM = new MovieCollectionViewModel(movies); return View(collectionVM); }
public ActionResult ViewCollection(int UserID) { var ops = new DVDLibraryOperations(); var moviesVM = new RentMovieShortViewModel(ops.GetMovieListRentShort()); Session["User"] = UserID; return View(moviesVM); }
public ActionResult ViewMovieForRent(int movieID, int movieInventory) { var ops = new DVDLibraryOperations(); var movie = ops.GetMovieDetails(movieID); var movieRatings = ops.GetMovieRatingsByID(movieID); var viewMovieVM = new RentMovieLongViewModel(movieRatings, movie); viewMovieVM.UserID = (int)Session["User"]; viewMovieVM.MovieInventory = movieInventory; return View(viewMovieVM); }
public ActionResult ViewDVD(int MovieID) { var ops = new DVDLibraryOperations(); var movie = ops.GetMovieDetails(MovieID); var dvdVM = new ViewMovieViewModel(movie); return View(dvdVM); }