public ActionResult Create(Movie movieToCreate) { if (ModelState.IsValid) { entities.AddToMovies(movieToCreate); entities.SaveChanges(); return RedirectToAction("Index"); } return View(movieToCreate); }
/// <summary> /// Deprecated Method for adding a new object to the Movies EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMovies(Movie movie) { base.AddObject("Movies", movie); }
/// <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> public static Movie CreateMovie(global::System.Int32 id, global::System.String title, global::System.String director) { Movie movie = new Movie(); movie.Id = id; movie.Title = title; movie.Director = director; return movie; }