Ejemplo n.º 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var mr      = new MoviesRepository();
            int movieId = Convert.ToInt32(txtMovieId.Text);

            mr.DeleteMovie(movieId);
            MessageBox.Show("Movie deleted successfully!", "Movie deleted");
            txtMovieId.Clear();
        }
Ejemplo n.º 2
0
        // GET: Movies/Delete/5
        public ActionResult Delete(int id)
        {
            List <Movies> movies = moviesRepository.ListMovie();

            Movies movie = (from m in movies
                            where m.Id == id
                            select m).Single();


            moviesRepository.DeleteMovie(movie);

            return(RedirectToAction("List"));
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Movie movie = moviesRepository.GetMovieById(id);

            if (!string.IsNullOrEmpty(movie.PosterFilePath) && movie.PosterFilePath != "~/Images/no-image.png")
            {
                string fullPath = Request.MapPath(movie.PosterFilePath);
                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(fullPath);
                }
            }
            TempData["Notification"] = movie.Name + " has been deleted from the movies database!";
            moviesRepository.DeleteMovie(id);
            return(RedirectToAction("Index"));
        }