public EditOrAddAwardWindowVM(ICollectionsEntity collectionEntity, AwardVM award = null) { _collectionEntity = collectionEntity; _award = award; ImageClearButtonVisibility = Visibility.Collapsed; if (_award != null) { if (_award.PerformerId != null) { Performer = new PerformerVM(DataLayer.Performer.GetById((Guid)_award.PerformerId)); } if (_award.EntertainmentId != null) { Entertainment = new EntertainmentVM(DataLayer.Entertainment.GetById((Guid)_award.EntertainmentId)); } Name = _award.Name; Nomination = _award.Nomination; Date = _award.Date; if (_award.Image != null) { ImageClearButtonVisibility = Visibility.Visible; } } NameErrorVisibility = Visibility.Hidden; DateErrorVisibility = Visibility.Hidden; Logger.Info("EditOrAddAwardWindowVM.EditOrAddAwardWindowVM", "Екземпляр EditOrAddAwardWindowVM створений."); }
public EditOrAddGenreInEntertainmentWindowVM(EntertainmentVM entertainment) { _entertainment = entertainment; _genreViewModel = new GenreUserControlVM(_entertainment.EntertainmentType); _genreViewModel.GenreTypesComboBoxVisibility = Visibility.Collapsed; _genreViewModel.AddButtonVisibility = Visibility.Collapsed; _genreViewModel.EditButtonVisibility = Visibility.Collapsed; _genreViewModel.DeleteButtonVisibility = Visibility.Collapsed; GenreInEntertainment[] genreInEntertainments = GenreInEntertainment.GetGenreInEntertainmentByEntertainment(_entertainment.EntertainmentDL); if (genreInEntertainments != null) { List <Guid> genreIds = new List <Guid>(); foreach (var genreInEntertainment in genreInEntertainments) { _genreInEntertainmentCollection.Add(new GenreInEntertainmentVM(genreInEntertainment)); genreIds.Add(genreInEntertainment.GenreId); } Genre[] genres = Genre.GetByIds(genreIds.ToArray()); foreach (var genre in genres) { _addedGenreCollection.Add(new GenreVM(genre)); } } Logger.Info("EditOrAddGenreInEntertainmentWindowVM.EditOrAddGenreInEntertainmentWindowVM", "Екземпляр EditOrAddGenreInEntertainmentWindowVM створений."); }
public EditOrAddSongInEntertainmentWindowVM(EntertainmentVM entertainment) { _album = entertainment; _songViewModel.AddButtonVisibility = Visibility.Collapsed; _songViewModel.EditButtonVisibility = Visibility.Collapsed; _songViewModel.DeleteButtonVisibility = Visibility.Collapsed; SongInEntertainment[] songInEntertainments = SongInEntertainment.GetSongInEntertainmentByEntertainment(_album.EntertainmentDL); if (songInEntertainments != null) { List <Guid> songIds = new List <Guid>(); foreach (var songInEntertainment in songInEntertainments) { _songInEntertainmentCollection.Add(new SongInEntertainmentVM(songInEntertainment)); songIds.Add(songInEntertainment.SongId); } Song[] songs = Song.GetByIds(songIds.ToArray()); foreach (var song in songs) { _addedSongCollection.Add(new SongVM(song)); } Logger.Info("EditOrAddSongInEntertainmentWindowVM.EditOrAddSongInEntertainmentWindowVM", "Екземпляр EditOrAddSongInEntertainmentWindowVM створений."); } }
public EditOrAddSongInEntertainmentWindow(EntertainmentVM entertainment) { InitializeComponent(); DataContext = new EditOrAddSongInEntertainmentWindowVM(entertainment); Logger.Info("EditOrAddSongInEntertainmentWindow.EditOrAddSongInEntertainmentWindow", "Екземпляр EditOrAddSongInEntertainmentWindow створений."); }
public EditOrAddEntertainmentWindow(ICollectionsEntity entity, EntertainmentVM entertainment = null) { InitializeComponent(); DataContext = new EditOrAddEntertainmentWindowVM(entity, entertainment); Logger.Info("EditOrAddEntertainmentWindow.EditOrAddEntertainmentWindow", "Екземпляр EditOrAddEntertainmentWindow створений."); }
public EntertainmentReviewsViewModel(Guid id, bool isCritic) { EntertainmentViewModel = new EntertainmentVM(Entertainment.GetById(id)); IsCritic = isCritic; AllEntertainmentCriticReviews = Review.GetReviewByEntertainment(EntertainmentViewModel.EntertainmentDL)?.Where((rev) => rev.Publication != null && rev.Publication != String.Empty)?.ToArray(); AllEntertainmentUserReviews = Review.GetReviewByEntertainment(EntertainmentViewModel.EntertainmentDL)?.Where((rev) => (rev.Publication == null || rev.Publication == String.Empty) && rev.CheckedByAdmin == true)?.ToArray(); PaginationCriticId = Guid.NewGuid(); PaginationUserId = Guid.NewGuid(); }
public void Add(object item) { EntertainmentVM newItem = item as EntertainmentVM; if (newItem != null) { _entertainmentCollection.Add(newItem); } }
internal bool OkButtonClick() { _isError = false; if (Name == null || Name == String.Empty) { NameErrorVisibility = Visibility.Visible; _isError = true; } else { NameErrorVisibility = Visibility.Hidden; } if (_genre != null && ParentGenre != null) { if (!_genre.CanBeParentGenre(ParentGenre)) { ParentGenreErrorVisibility = Visibility.Visible; _isError = true; } else { ParentGenreErrorVisibility = Visibility.Hidden; } } if (_isError) { return(false); } if (_genre == null) { GenreVM genre = new GenreVM(ParentGenre, Name, (Entertainment.Type)EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(GenreTypeUkr), Summary); genre.GenreDL.Save(); _collectionEntity.Add(genre); } else { if (ParentGenre != null) { _genre.ParentGenreId = ParentGenre.GenreDL.Id; } else { _genre.ParentGenreId = null; } _genre.Name = Name; _genre.GenreType = (Entertainment.Type)EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(GenreTypeUkr); _genre.Summary = Summary; _genre.GenreDL.Save(); } return(true); }
public EditOrAddPerformerInEntertainmentWindowVM(EntertainmentVM entertainment) { _entertainment = entertainment; if (_entertainment.EntertainmentType == DataLayer.Entertainment.Type.Movie) { _movieDirectorViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.MovieDirector); _moviePlotWriterViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.MoviePlotWriter); _moviePrincipalCastViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.MoviePrincipalCast); _movieCastViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.MovieCast); _movieProducerViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.MovieProducer); _movieProductionViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.MovieProduction); } if (_entertainment.EntertainmentType == DataLayer.Entertainment.Type.Game) { _gameCastViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.GameCast); _gameDeveloperCompanyViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.GameDeveloperCompany); _gamePlatformViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.GamePlatform); } if (_entertainment.EntertainmentType == DataLayer.Entertainment.Type.TVSeries) { _tVCastViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.TVCast); _tVNetworkViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.TVNetwork); } if (_entertainment.EntertainmentType == DataLayer.Entertainment.Type.Album) { _albumSingerViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.AlbumSinger); _albumBandViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.AlbumBand); _albumRecordLabelViewModel = new EditOrAddPerformerInEntertainmentUserControlVM(entertainment, PerformerInEntertainment.Role.AlbumRecordLabel); } switch (_entertainment.EntertainmentType) { case DataLayer.Entertainment.Type.Album: SelectedTabIndex = 11; break; case DataLayer.Entertainment.Type.Game: SelectedTabIndex = 6; break; case DataLayer.Entertainment.Type.Movie: SelectedTabIndex = 0; break; case DataLayer.Entertainment.Type.TVSeries: SelectedTabIndex = 9; break; } Logger.Info("EditOrAddPerformerInEntertainmentWindowVM.EditOrAddPerformerInEntertainmentWindowVM", "Екземпляр EditOrAddPerformerInEntertainmentWindowVM створений."); }
public EntertainmentDetailsWindow(EntertainmentVM entertainment) { InitializeComponent(); _entertainment = entertainment; DataContext = new EntertainmentDetailsWindowVM(_entertainment); YoutubeVideo.Navigate(new Uri(_entertainment.TrailerLink.Replace("https://www.youtube.com/watch?v=", "https://www.youtube.com/embed/"))); Logger.Info("EntertainmentDetailsWindow.EntertainmentDetailsWindow", "Екземпляр EntertainmentDetailsWindow створений."); }
public PerformerAndEntertainmentViewModel(EntertainmentVM entertainmentViewModel = null, PerformerVM performerViewModel = null) { if (entertainmentViewModel != null) { PerformerOrEntertainment = entertainmentViewModel; ContentType = Content.Entertainment; } if (performerViewModel != null) { PerformerOrEntertainment = performerViewModel; ContentType = Content.Performer; } }
internal void SearchButtonClick() { _genreCollection.Clear(); Genre[] genres = Genre.GetByName(PartOfNameForSearch, EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(SelectedType)); if (genres != null) { foreach (var genre in genres) { _genreCollection.Add(new GenreVM(genre)); } } }
public EditOrAddEntertainmentWindowVM(ICollectionsEntity collectionEntity, EntertainmentVM enterteinment = null) { _collectionEntity = collectionEntity; _enterteinment = enterteinment; if (_enterteinment != null) { EntertainmentTypeUkr = _enterteinment.EntertainmentTypeUkr; Name = _enterteinment.Name; ReleaseDate = _enterteinment.ReleaseDate; Company = _enterteinment.Company; Summary = _enterteinment.Summary; BuyLink = _enterteinment.BuyLink; MainLanguage = _enterteinment.MainLanguage; Rating = _enterteinment.Rating; RatingComment = _enterteinment.RatingComment; MovieRuntimeMinute = _enterteinment.MovieRuntimeMinute; OfficialSite = _enterteinment.OfficialSite; MovieCountries = _enterteinment.MovieCountries; TVSeason = _enterteinment.TVSeason; Budget = _enterteinment.Budget; TrailerLink = _enterteinment.TrailerLink; } NameErrorVisibility = Visibility.Hidden; PosterErrorVisibility = Visibility.Hidden; ReleaseDateErrorVisibility = Visibility.Hidden; CompanyErrorVisibility = Visibility.Hidden; MainLanguageErrorVisibility = Visibility.Hidden; SummaryErrorVisibility = Visibility.Hidden; if (EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr) != Entertainment.Type.Movie) { MovieRuntimeMinuteErrorVisibility = Visibility.Collapsed; } else { MovieRuntimeMinuteErrorVisibility = Visibility.Hidden; } if (EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr) == Entertainment.Type.Album) { TrailerLinkErrorVisibility = Visibility.Collapsed; } else { TrailerLinkErrorVisibility = Visibility.Hidden; } Logger.Info("EditOrAddEntertainmentWindowVM.EditOrAddEntertainmentWindowVM", "Екземпляр EditOrAddEntertainmentWindowVM створений."); }
internal void entertainmentTypeUkrComboBoxSelectionChanged() { OnPropertyChanged("MovieRuntimeMinuteVisibility"); OnPropertyChanged("TVSeasonVisibility"); OnPropertyChanged("TrailerLinkVisibility"); OnPropertyChanged("MovieCountriesVisibility"); if (EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr) != Entertainment.Type.Movie) { MovieRuntimeMinuteErrorVisibility = Visibility.Collapsed; } if (EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr) == Entertainment.Type.Album) { TrailerLinkErrorVisibility = Visibility.Collapsed; } }
private PerformerVM[] GetPerformerVMByEntertainmentVMAndRole(EntertainmentVM entertainment, PerformerInEntertainment.Role role) { Performer[] performers = Performer.GetPerformerByEntertainmentAndRole(entertainment.EntertainmentDL, role); if (performers == null) { return(null); } List <PerformerVM> result = new List <PerformerVM>(); foreach (var performer in performers) { result.Add(new PerformerVM(performer)); } return(result.ToArray()); }
public GenreUserControlVM(Entertainment.Type?type = null) { GenreTypesComboBoxVisibility = Visibility.Visible; AddButtonVisibility = Visibility.Visible; EditButtonVisibility = Visibility.Visible; DeleteButtonVisibility = Visibility.Visible; if (type != null) { _selectedType = EntertainmentVM.EntertainmentTypeToUkrString((Entertainment.Type)type); } Genre[] genres = Genre.GetRandomFirstTen(type); if (genres != null) { foreach (var genre in genres) { _genreCollection.Add(new GenreVM(genre)); } } Logger.Info("GenreUserControlVM.GenreUserControlVM", "Екземпляр GenreUserControlVM створений."); }
public EntertainmentDetailsWindowVM(EntertainmentVM entertainment) { _entertainment = entertainment; Logger.Info("EntertainmentDetailsWindowVM.EntertainmentDetailsWindowVM", "Екземпляр EntertainmentDetailsWindowVM створений."); }
internal void SearchButtonClick() { _entertainmentCollection.Clear(); Entertainment[] entertainments = Entertainment.GetByName(PartOfNameForSearch, EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(SelectedType)); if (entertainments != null) { foreach (var entert in entertainments) { _entertainmentCollection.Add(new EntertainmentVM(entert)); } } }
public EditOrAddPerformerInEntertainmentUserControlVM(EntertainmentVM entertainment, PerformerInEntertainment.Role role) { _entertainment = entertainment; _role = role; Performer.Type type; switch (role) { case PerformerInEntertainment.Role.AlbumBand: type = Performer.Type.Band; break; case PerformerInEntertainment.Role.AlbumRecordLabel: type = Performer.Type.RecordLabel; break; case PerformerInEntertainment.Role.AlbumSinger: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.GameCast: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.GameDeveloperCompany: type = Performer.Type.GameDeveloperCompany; break; case PerformerInEntertainment.Role.GamePlatform: type = Performer.Type.GamePlatform; break; case PerformerInEntertainment.Role.MovieCast: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.MovieDirector: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.MoviePlotWriter: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.MoviePrincipalCast: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.MovieProducer: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.MovieProduction: type = Performer.Type.MovieProduction; break; case PerformerInEntertainment.Role.TVCast: type = Performer.Type.Person; break; case PerformerInEntertainment.Role.TVNetwork: type = Performer.Type.TVNetwork; break; default: type = Performer.Type.Person; break; } _performerViewModel = new PerformerUserControlVM(type); _performerViewModel.PerformerTypesComboBoxVisibility = Visibility.Collapsed; _performerViewModel.AddButtonVisibility = Visibility.Collapsed; _performerViewModel.EditButtonVisibility = Visibility.Collapsed; _performerViewModel.DeleteButtonVisibility = Visibility.Collapsed; PerformerInEntertainment[] performerInEntertainments = PerformerInEntertainment.GetPerformerInEntertainmentByEntertainmentAndRole(_entertainment.EntertainmentDL, role); if (performerInEntertainments != null) { List <Guid> performerIds = new List <Guid>(); foreach (var performerInEntertainment in performerInEntertainments) { _performerInEntertainmentCollection.Add(new PerformerInEntertainmentVM(performerInEntertainment)); performerIds.Add(performerInEntertainment.PerformerId); } Performer[] performers = Performer.GetByIds(performerIds.ToArray()); foreach (var performer in performers) { _addedPerformerCollection.Add(new PerformerVM(performer)); } } Logger.Info("EditOrAddPerformerInEntertainmentUserControlVM.EditOrAddPerformerInEntertainmentUserControlVM", "Екземпляр EditOrAddPerformerInEntertainmentUserControlVM створений."); }
public EntertainmentDetailsViewModel(Guid entertainmentId) { _entertainment = new EntertainmentVM(Entertainment.GetById(entertainmentId)); _avarageCriticPoint = _entertainment.EntertainmentDL.AverageCriticPointForOneEntertainment(); _avarageUserPoint = _entertainment.EntertainmentDL.AverageUserPointForOneEntertainment(); _trailerLinkForFrame = _entertainment.TrailerLink.Replace("https://www.youtube.com/watch?v=", "https://www.youtube.com/embed/"); _movieProductions = this.GetPerformersStringByRole(PerformerInEntertainment.Role.MovieProduction); _gameDeveloperCompanys = this.GetPerformersStringByRole(PerformerInEntertainment.Role.GameDeveloperCompany); _gamePlatforms = this.GetPerformersStringByRole(PerformerInEntertainment.Role.GamePlatform); _tVNetwork = this.GetPerformersStringByRole(PerformerInEntertainment.Role.TVNetwork); _albumRecordLabel = this.GetPerformersStringByRole(PerformerInEntertainment.Role.AlbumRecordLabel); _genres = this.GetGenreString(); _singersAndBands = _entertainment.AlbumAuthors != null?_entertainment.AlbumAuthors.Remove(_entertainment.AlbumAuthors.Length - 2, 2) : null; Song[] songsInAlbum = Song.GetSongsByAlbum(_entertainment.EntertainmentDL); if (songsInAlbum != null) { List <SongVM> songs = new List <SongVM>(); foreach (var song in songsInAlbum) { songs.Add(new SongVM(song)); } _songs = songs.ToArray(); } _movieDirectors = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.MovieDirector); _moviePlotWriters = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.MoviePlotWriter); _moviePrincipalCasts = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.MoviePrincipalCast); _movieCasts = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.MovieCast); _movieProducers = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.MovieProducer); _gameCasts = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.GameCast); _tVCasts = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.TVCast); _albumSingers = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.AlbumSinger); _albumBands = this.GetPerformerVMByEntertainmentVMAndRole(_entertainment, PerformerInEntertainment.Role.AlbumBand); _awards = this.GetAwardByEntertainment(_entertainment.EntertainmentDL); _reviews = Review.GetReviewByEntertainment(_entertainment.EntertainmentDL); if (_reviews != null) { _positiveCriticReviewCount = (from review in _reviews.AsParallel() where review.Point >= 70 && review.Publication != null && review.Publication != String.Empty select review).Count(); _neutralCriticReviewCount = (from review in _reviews.AsParallel() where review.Point > 35 && review.Point < 70 && review.Publication != null && review.Publication != String.Empty select review).Count(); _negativeCriticReviewCount = (from review in _reviews.AsParallel() where review.Point <= 35 && review.Publication != null && review.Publication != String.Empty select review).Count(); _positiveUserReviewCount = (from review in _reviews.AsParallel() where review.Point >= 70 && (review.Publication == null || review.Publication == String.Empty) && review.CheckedByAdmin == true select review).Count(); _neutralUserReviewCount = (from review in _reviews.AsParallel() where review.Point > 35 && review.Point < 70 && (review.Publication == null || review.Publication == String.Empty) && review.CheckedByAdmin == true select review).Count(); _negativeUserReviewCount = (from review in _reviews.AsParallel() where review.Point <= 35 && (review.Publication == null || review.Publication == String.Empty) && review.CheckedByAdmin == true select review).Count(); _criticReviews = (from review in _reviews.AsParallel() where review.Publication != null && review.Publication != String.Empty select review).OrderByDescending((rev) => rev.Time).Take(5).ToArray(); _userReviews = (from review in _reviews.AsParallel() where (review.Publication == null || review.Publication == String.Empty) && review.CheckedByAdmin == true select review).OrderByDescending((rev) => rev.Time).Take(5).ToArray(); } }
internal bool OkButtonClick() { _isError = false; if (Name == null || Name == String.Empty) { NameErrorVisibility = Visibility.Visible; _isError = true; } else { NameErrorVisibility = Visibility.Hidden; } if (_enterteinment == null && (Poster == null || Poster == String.Empty)) { PosterErrorVisibility = Visibility.Visible; _isError = true; } else { PosterErrorVisibility = Visibility.Hidden; } if (ReleaseDate == null) { ReleaseDateErrorVisibility = Visibility.Visible; _isError = true; } else { ReleaseDateErrorVisibility = Visibility.Hidden; } if (Company == null || Company == String.Empty) { CompanyErrorVisibility = Visibility.Visible; _isError = true; } else { CompanyErrorVisibility = Visibility.Hidden; } if (MainLanguage == null || MainLanguage == String.Empty) { MainLanguageErrorVisibility = Visibility.Visible; _isError = true; } else { MainLanguageErrorVisibility = Visibility.Hidden; } if (Summary == null || Summary == String.Empty) { SummaryErrorVisibility = Visibility.Visible; _isError = true; } else { SummaryErrorVisibility = Visibility.Hidden; } if (EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr) == Entertainment.Type.Movie && MovieRuntimeMinute == null) { MovieRuntimeMinuteErrorVisibility = Visibility.Visible; _isError = true; } else { MovieRuntimeMinuteErrorVisibility = Visibility.Collapsed; } if (TrailerLink != null) { if (TrailerLink.Replace("https://www.youtube.com/watch?v=", "").Contains(" ") && EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr) != Entertainment.Type.Album) { TrailerLinkErrorVisibility = Visibility.Visible; _isError = true; } else { TrailerLinkErrorVisibility = Visibility.Collapsed; } } if (TrailerLink == "https://www.youtube.com/watch?v=") { TrailerLink = null; } if (_isError) { return(false); } switch (EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr)) { case Entertainment.Type.Album: MovieRuntimeMinute = null; MovieCountries = null; TVSeason = null; TrailerLink = null; break; case Entertainment.Type.Game: MovieRuntimeMinute = null; MovieCountries = null; TVSeason = null; break; case Entertainment.Type.Movie: TVSeason = null; break; case Entertainment.Type.TVSeries: MovieRuntimeMinute = null; MovieCountries = null; break; } if (_enterteinment == null) { EntertainmentVM entertainment = new EntertainmentVM((Entertainment.Type)EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr), Name, (DateTime)ReleaseDate, Company, File.ReadAllBytes(Poster), Summary, BuyLink, MainLanguage, Rating, RatingComment, MovieRuntimeMinute, OfficialSite, MovieCountries, TVSeason, Budget, TrailerLink); entertainment.EntertainmentDL.Save(); _collectionEntity.Add(entertainment); } else { _enterteinment.EntertainmentType = (Entertainment.Type)EntertainmentVM.EntertainmentTypeUkrStringToEngEnum(EntertainmentTypeUkr); _enterteinment.Name = Name; _enterteinment.ReleaseDate = (DateTime)ReleaseDate; _enterteinment.Company = Company; if (Poster != null && Poster != String.Empty) { _enterteinment.Poster = File.ReadAllBytes(Poster); } _enterteinment.Summary = Summary; _enterteinment.BuyLink = BuyLink; _enterteinment.MainLanguage = MainLanguage; _enterteinment.Rating = Rating; _enterteinment.RatingComment = RatingComment; _enterteinment.MovieRuntimeMinute = MovieRuntimeMinute; _enterteinment.OfficialSite = OfficialSite; _enterteinment.MovieCountries = MovieCountries; _enterteinment.TVSeason = TVSeason; _enterteinment.Budget = Budget; _enterteinment.TrailerLink = TrailerLink; _enterteinment.EntertainmentDL.Save(); } return(true); }