Exemplo n.º 1
0
 /// <summary>
 /// Create a new Movie object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="director">Initial value of the Director property.</param>
 /// <param name="dateReleased">Initial value of the DateReleased property.</param>
 public static Movie CreateMovie(global::System.Int32 id, global::System.String title, global::System.String director, global::System.DateTime dateReleased)
 {
     Movie movie = new Movie();
     movie.Id = id;
     movie.Title = title;
     movie.Director = director;
     movie.DateReleased = dateReleased;
     return movie;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Movies EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMovies(Movie movie)
 {
     base.AddObject("Movies", movie);
 }
Exemplo n.º 3
0
        public ActionResult Edit(int id, Movie movieEdit )
        {
            using (MoviesDBEntities ctx = new MoviesDBEntities())
            {
                // Recuperamos la pelicula original
                var movieOriginal = ctx.Movies.Where(m => m.Id == movieEdit.Id).First();

                if (!ModelState.IsValid)
                {
                    return View(movieEdit);
                }

                // Aplicamos los cambios
                ctx.ApplyCurrentValues(movieOriginal.EntityKey.EntitySetName, movieEdit);
                ctx.SaveChanges();
            }

            return RedirectToAction("Index");
        }