private void AddMovieButton_Click(object sender, EventArgs e) { var addForm = new AddMovieForm(); if (addForm.ShowDialog() == DialogResult.OK) { if (MovieOperations.AddMovie(addForm.Movie)) { try { MoviesListView.Items.Add(new ListViewItem(addForm.Movie.ItemArray)); } catch (Exception ex) { MessageBox.Show($"Encountered the following issue\n{ex.Message}"); } } else { MessageBox.Show("Failed to add movie"); } } // ReSharper disable once RedundantIfElseBlock else { // user cancelled } }
public ActionResult Details(int movieID) { var ops = new MovieOperations(); var movieResponse = ops.GetMovieByID(movieID); return View("Details", movieResponse.Movie); }
public ActionResult ConfirmDelete(int movieID) { var ops = new MovieOperations(); ops.RemoveMovie(movieID); var movieResponse = ops.GetMovieByID(movieID); return View("ConfirmDelete", movieResponse.Movie); }
public ActionResult Add() { var ops = new MovieOperations(); MovieInfoVM movieInfoVm = new MovieInfoVM(); movieInfoVm.CreateMpaaRatingsList(ops.GetAllMpaaRatings().MpaaRatings); movieInfoVm.CreateActorsList(ops.GetAllActors().Actors); movieInfoVm.CreateBorrowersList(ops.GetAllBorrowers().Borrowers); movieInfoVm.CreateStudiosList(ops.GetAllStudios().Studios); movieInfoVm.CreateDirectorsList(ops.GetAllDirectors().Directors); return View(movieInfoVm); }
private async void Form1_Shown(object sender, EventArgs e) { var movies = await MovieOperations.GetMovies(); // ReSharper disable once PossibleInvalidOperationException - var sorted = movies.OrderBy(x => x.Duration.Value.Hours); foreach (var movie in sorted) { MoviesListView.Items.Add(new ListViewItem(movie.ItemArray)); } MoviesListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); MoviesListView.FocusedItem = MoviesListView.Items[0]; MoviesListView.Items[0].Selected = true; }
public ActionResult Add(MovieInfoVM movieInfoVm) { var ops = new MovieOperations(); movieInfoVm.CreateMpaaRatingsList(ops.GetAllMpaaRatings().MpaaRatings); movieInfoVm.CreateActorsList(ops.GetAllActors().Actors); movieInfoVm.CreateBorrowersList(ops.GetAllBorrowers().Borrowers); movieInfoVm.CreateStudiosList(ops.GetAllStudios().Studios); movieInfoVm.CreateDirectorsList(ops.GetAllDirectors().Directors); if (ModelState.IsValid) { var addMovieResponse = ops.AddMovie(movieInfoVm.Movie); var addedMovieResponse = ops.GetMovieByID(addMovieResponse.Movie.MovieID); return View("Details", addedMovieResponse.Movie); } else { return View(movieInfoVm); } }
public ActionResult Track(int movieID) { var ops = new MovieOperations(); var movie = ops.TrackDvd(movieID); return View("Track", movie.Rentals); }
// GET: Home public ActionResult Index() { var ops = new MovieOperations(); var moviesResponse = ops.GetAllMovies(); return View(moviesResponse.Movies); }
public void Setup() { _ops = new MovieOperations(); _response = new Response(); }