Пример #1
0
        public IActionResult EnterMovies(EnterMoviesModel enterMovies)
        {
            //ensures data is valid before putting it into the temporary storage
            if (ModelState.IsValid)
            {
                TempMovieStorage.AddApplication(enterMovies); //calls the AddApplication method in the TempMovieStorage class and passes it the instance of the object
                Response.Redirect("DisplayMovies");
            }

            //loads the EnterMovies view and passes it the instanse of enterMovies
            return(View());
        }
        public IActionResult DeleteRow(EnterMoviesModel movie)
        {
            context.Filmes.Remove(movie);
            context.SaveChanges();

            //returns the view and the information from the database, excluding entries with "Independence Day"
            return(View("DisplayMovies", new FilmListViewModel
            {
                Filmes = _repository.Filmes
                         .Where(f => f.title != "Independence Day")
            }));
        }
        public IActionResult EditMovies(EnterMoviesModel movie)
        {
            if (ModelState.IsValid)
            {
                context.Filmes.Update(movie);
                context.SaveChanges();

                //returns the view and the information from the database, excluding entries with "Independence Day"
                return(View("DisplayMovies", new FilmListViewModel
                {
                    Filmes = _repository.Filmes
                             .Where(f => f.title != "Independence Day")
                }));
            }

            return(View("Index"));
        }
 public IActionResult EditRow(EnterMoviesModel movie)
 {
     return(View("EditMovie", movie));
 }