public static MovieSet MovieModel2MovieSet(Movie movie) { MovieSet movieSet = null; if (movie != null) { movieSet = new MovieSet(); movieSet.ID = movie.ID; movieSet.Title = movie.Title; movieSet.ImageUrl = movie.ImageUrl; } return movieSet; }
public static Movie MovieSet2MovieModel(MovieSet movieSet) { Movie movie = null; if (movieSet != null) { movie = new Movie(); movie.ID = movieSet.ID; movie.Title = movieSet.Title; movie.ImageUrl = movieSet.ImageUrl; movie.ReleaseYear = movieSet.ReleaseDate.Year; } return movie; }
public ActionResult Create(MovieSet movie) { if (ModelState.IsValid) { using (var ctx = new MoviesContext()) { ctx.AddToMovieSets(movie); ctx.SaveChanges(); return RedirectToAction("Index"); } } return View(movie); }
public void Edit(MovieSet movie) { db.MovieSets.Attach(movie); db.ObjectStateManager.ChangeObjectState(movie, EntityState.Modified); db.SaveChanges(); }
public void Create(MovieSet movie) { db.MovieSets.AddObject(movie); db.SaveChanges(); }
/// <summary> /// Create a new MovieSet object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="releaseDate">Initial value of the ReleaseDate property.</param> public static MovieSet CreateMovieSet(global::System.Int32 id, global::System.String title, global::System.DateTime releaseDate) { MovieSet movieSet = new MovieSet(); movieSet.ID = id; movieSet.Title = title; movieSet.ReleaseDate = releaseDate; return movieSet; }
/// <summary> /// Deprecated Method for adding a new object to the MovieSets EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMovieSets(MovieSet movieSet) { base.AddObject("MovieSets", movieSet); }