Example #1
0
        public void RateForContent(int vote, Guid id)
        {
            Review review = new Review(ProfileCritic.Instance.CurrentUserCritic, Entertainment.GetById(id), (byte)vote, "", DateTime.UtcNow, null,
                                       ProfileCritic.Instance.CurrentUserCritic.UserRole == UserCritic.Role.Critic ? ProfileCritic.Instance.CurrentUserCritic.PublicationCompany : null,
                                       0, 0, ProfileCritic.Instance.CurrentUserCritic.UserRole == UserCritic.Role.Critic ? true : false);

            review.Save();
        }
Example #2
0
 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();
 }
Example #3
0
        public void OpinionAndLinkCaption(string opinion, string link, Guid id)
        {
            Review review = Review.GetReviewByEntertainmentAndUser(Entertainment.GetById(id), ProfileCritic.Instance.CurrentUserCritic);

            review.Opinion = opinion;
            if (link != "undefined")
            {
                review.Link = link;
            }
            review.Save();
        }
        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();
            }
        }