Пример #1
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        //Update the actor.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Actor).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ActorExists(Actor.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        //Adds the movie to the database.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Movie.Add(Movie);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        //Deletes the Director uses a lamda query to select the director
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Director = (from director in _context.Director
                        where director.Id == id
                        select director).FirstOrDefault();

            if (Director != null)
            {
                _context.Director.Remove(Director);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Пример #4
0
        //Deletes the movie cast from the databse. Uses a linq query to
        //select the movie cast
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            MovieCastAssignment = (from moviecasts in _context.MovieCastAssignment
                                   where moviecasts.Id == id
                                   select moviecasts).FirstOrDefault();

            if (MovieCastAssignment != null)
            {
                _context.MovieCastAssignment.Remove(MovieCastAssignment);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Пример #5
0
        //Removes the movie uses a linq query to select the movie
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Movie = (from movie in _context.Movie
                     where movie.Id == id
                     select movie).FirstOrDefault();



            if (Movie != null)
            {
                _context.Movie.Remove(Movie);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }