public ActionResult Delete(int id) { MovieManager.Delete(id); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { //Movie movie = db.Movies.Find(id); //db.Movies.Remove(movie); //db.SaveChanges(); MovieManager.Delete(id); return(RedirectToAction("Index")); }
public ActionResult Delete(Movie movie) { using (manager = new MovieManager()) { manager.Delete(movie.Id); } return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { Movie movie = movieManager.Find(I => I.Id == id); movieManager.Delete(movie); if (movie.ImagePath != "defaultPoster.png") { System.IO.File.Delete(Server.MapPath($"~/img/MoviePoster/{movie.ImagePath}")); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id, Movie movie) { try { // TODO: Add delete logic here MovieManager.Delete(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here MovieManager.Delete(id); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.message = ex.Message; return(View()); } }
public IHttpActionResult Delete(int?id) { if (id == null) { return(BadRequest()); } if (MovieManager.Delete(id.Value)) { return(Ok()); } else { return(NotFound()); } }
public ActionResult Delete(int id, Movie movie) { try { // TODO: Add delete logic here movie.Genres = MovieManager.LoadGenres(id); movie.Genres.ForEach(g => MovieGenreManager.Delete(id, g.Id)); MovieManager.Delete(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult DeleteConfirm(string id, string returnurl) { if (!MovieManager.Exist(id)) { return(RedirectToAction("NotFound", "Error")); } string oldAvatar = _db.tbl_Movie.SingleOrDefault(m => m.movie_Id == id).movie_Avatar; if (oldAvatar != "Movie_Default.png") { ImageManager.Delete(Server.MapPath("~/Content/Movie/" + oldAvatar)); } MovieManager.Delete(id); return(Redirect(returnurl)); }
private void DeleteMovie() { var result = CheckInputs(); if (result) { movie.Id = Int32.Parse(listView1.SelectedItems[0].SubItems[0].Text); movie.DirectorId = DirectorId(); movie.GenreId = GenreId(); movie.Name = listView1.SelectedItems[0].SubItems[5].Text; movie.Title = listView1.SelectedItems[0].SubItems[6].Text; movie.ReleaseYear = listView1.SelectedItems[0].SubItems[7].Text; movie.Rating = double.Parse(listView1.SelectedItems[0].SubItems[8].Text); movie.MovieLength = Int32.Parse(listView1.SelectedItems[0].SubItems[9].Text); movie.dailyPrice = double.Parse(listView1.SelectedItems[0].SubItems[10].Text); movieManager.Delete(movie); } }
public void DeleteTest() { // Insert a movie to be deleted Movie movie = new Movie(); movie.Title = "test"; movie.Description = "test"; movie.ImagePath = "test"; movie.Cost = 1; movie.InStockQty = 3; movie.RatingId = 3; movie.FormatId = 1; movie.DirectorId = 1; bool result = MovieManager.Insert(movie); // Delete new movie int MovieDelete = MovieManager.Delete(4); Assert.IsTrue(MovieDelete > 0); }
public long Delete(int id) { return(_repo.Delete(id)); }
public void DeleteTest() { Assert.IsTrue(MovieManager.Delete(3) > 0); }
public ActionResult Delete(int id, int cinemaId) { MovieManager.Delete(id); return(RedirectToAction("Edit", "Cinema", new { id = cinemaId })); }