Esempio n. 1
0
 public void UpdateMovie(Movie movie)
 {
     var dbMovie = FindMovie(movie.Id);
     dbMovie.Name = movie.Name;
     dbMovie.Director = movie.Director;
     dbMovie.ReleaseDate = movie.ReleaseDate;
     _db.SaveChanges();
 }
Esempio n. 2
0
 public ActionResult Create(Movie movie)
 {
     try
     {
         _repo.Add<Movie>(movie);
         _repo.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Esempio n. 3
0
 public void CreateMovie(Movie movie)
 {
     _db.Movies.Add(movie);
     _db.SaveChanges();
 }
Esempio n. 4
0
 public ActionResult Edit(int id, Movie movie)
 {
     try
     {
         movie.Id = id;
         var dbMove = _repo.Find<Movie>(id);
         dbMove.Name = movie.Name;
         dbMove.ReleaseDate = movie.ReleaseDate;
         dbMove.Director = movie.Director;
         _repo.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }