예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 public ActionResult Create(MovieSet movie)
 {
     if (ModelState.IsValid)
     {
         using (var ctx = new MoviesContext())
         {
             ctx.AddToMovieSets(movie);
             ctx.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     return View(movie);
 }
예제 #4
0
 public void Edit(MovieSet movie)
 {
     db.MovieSets.Attach(movie);
     db.ObjectStateManager.ChangeObjectState(movie, EntityState.Modified);
     db.SaveChanges();
 }
예제 #5
0
 public void Create(MovieSet movie)
 {
     db.MovieSets.AddObject(movie);
     db.SaveChanges();
 }
예제 #6
0
 /// <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;
 }
예제 #7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the MovieSets EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMovieSets(MovieSet movieSet)
 {
     base.AddObject("MovieSets", movieSet);
 }