public ActionResult DeleteConfirmed(int id)
 {
     Movie.Models.Movie movie = db.Movies.Find(id);
     db.Movies.Remove(movie);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
 public ActionResult Edit([Bind(Include = "ID,Title,REleaseDate,price")] Movie.Models.Movie movie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movie).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(movie);
 }
        public ActionResult Create([Bind(Include = "ID,Title,REleaseDate,price")] Movie.Models.Movie movie)
        {
            if (ModelState.IsValid)
            {
                db.Movies.Add(movie);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(movie);
        }
 // GET: Movies/Edit/5
 public ActionResult Edit(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     Movie.Models.Movie movie = db.Movies.Find(id);
     if (movie == null)
     {
         return HttpNotFound();
     }
     return View(movie);
 }
Beispiel #5
0
        public IActionResult AddMovie(int id)
        {
            if (id > 0)
            {
                Movie.Models.Movie objmovie = _context.Movies.Where(m => m.MovieId == id).SingleOrDefault();
                if (objmovie != null)
                {
                    MovieViewModel obj = new MovieViewModel {
                        MovieId = objmovie.MovieId, MovieName = objmovie.MovieName, Year = objmovie.Year
                    };
                    return(View(obj));
                }
            }


            return(View());
        }