// // GET: /DeleteThis/ public ActionResult Index(string entry = "Send me an argument") { //Am I supposed to add a model class to the view for any Razor properities I want to invoke? Hence why I'm using a movie object here Movie tempmovie = new Movie(); tempmovie.Title = entry; return View(tempmovie); }
public void AddMovie(Movie movieToAdd) { using (var db = new MovieReviewsEntities()) { db.Movies.Add(movieToAdd); db.SaveChanges(); } }
public void Delete(int movieId) { using (var db = new MovieReviewsEntities()) { var movieToDelete = new Movie { MovieID = movieId }; db.Movies.Attach(movieToDelete); db.Movies.Remove(movieToDelete); db.SaveChanges(); } }
public ActionResult display(Movie input) { Movie temp = new Movie(); return RedirectToAction("index", new {entry = input.Title}); }
public ActionResult Edit(Movie movie) { if (ModelState.IsValid) { movieRepo.Update(movie); } return View(movie); }
public ActionResult Add(Movie model) { movieRepo.AddMovie(model); return RedirectToAction("index", new { idOfChangedMovie = model.MovieID }); }
public void Update(Movie movieToUpdate) { using (var db = new MovieReviewsEntities()) { db.Movies.Attach(movieToUpdate); db.Entry<Movie>(movieToUpdate).State = System.Data.EntityState.Modified; db.SaveChanges(); } }