/// <summary> /// The add movie to set. /// </summary> /// <param name="movie">The movie.</param> /// <param name="setName">The set name.</param> /// <param name="order">The order.</param> public static void AddMovieToSet(MovieModel movie, string setName, int?order = null) { MovieSetModel check = (from m in database where m.SetName == setName select m).SingleOrDefault(); var movieSetObjectModel = new MovieSetObjectModel { MovieUniqueId = movie.MovieUniqueId }; if (order != null) { movieSetObjectModel.Order = (int)order; } if (check == null) { var movieSetModel = new MovieSetModel(); movieSetModel.Movies.Add(movieSetObjectModel); movieSetModel.SetName = setName; database.Add(movieSetModel); } else { check.AddMovie(movie, order); } movie.ChangedText = true; SetAllMoviesChangedInCurrentSet(); }
/// <summary> /// Adds the movie to current set. /// </summary> /// <param name="movie">The movie to add to set</param> public static void AddMovieToCurrentSet(MovieModel movie) { MovieSetObjectModel check = (from m in currentSet.Movies where m.MovieUniqueId == movie.MovieUniqueId select m).SingleOrDefault(); if (check != null) { XtraMessageBox.Show(string.Format("{0} already exists in set {1}", movie.Title, currentSet.SetName)); return; } currentSet.AddMovie(movie); InvokeCurrentSetMoviesChanged(new EventArgs()); }