Пример #1
0
        public void BanReviewByReviewId(Guid reviewId, ReportReason reportReason)
        {
            try
            {
                var review = FilmHausDbContext.Reviews.Find(reviewId);

                if (review == null)
                {
                    throw new ArgumentNullException();
                }

                switch (review.ReviewType)
                {
                case ReviewType.Film:
                    var reviewFilm = FilmHausDbContext.ReviewFilms.Where(rf => rf.ReviewId == reviewId && rf.ObsoletedOn == null).FirstOrDefault();
                    ReviewFilmService.ObsoleteReviewFilm(reviewFilm.ReviewId, reviewFilm.MediaId);
                    break;

                case ReviewType.Show:
                    var reviewShow = FilmHausDbContext.ReviewShows.Where(rf => rf.ReviewId == reviewId && rf.ObsoletedOn == null).FirstOrDefault();
                    ReviewShowService.ObsoleteReviewShow(reviewShow.ReviewId, reviewShow.MediaId);
                    break;

                case ReviewType.Season:
                    break;

                case ReviewType.Episode:
                    break;

                default:
                    break;
                }

                review.ReportReason = reportReason;
                review.Shared       = false;
                review.IsActive     = false;

                FilmHausDbContext.Entry(review).State = EntityState.Modified;
                FilmHausDbContext.SaveChanges();
            }
            catch
            {
                throw;
            }
        }
Пример #2
0
        public void ObsoleteReviewForFilm(Guid reviewId, Guid mediaId)
        {
            try
            {
                ReviewFilmService.ObsoleteReviewFilm(reviewId, mediaId);

                var review = FilmHausDbContext.Reviews.Find(reviewId);

                if (review == null)
                {
                    throw new ArgumentNullException();
                }

                review.IsActive = false;

                FilmHausDbContext.Entry(review).State = EntityState.Modified;
                FilmHausDbContext.SaveChanges();
            }
            catch
            {
                throw;
            }
        }