Exemplo n.º 1
0
        public Entities.Models.IPagedResponse <ReviewDTO> GetReviews(int UserId, int PageNumber, int PageSize, ReviewSortState sortState)
        {
            var reviewsList = _mapper.Map <IEnumerable <Review>, IEnumerable <ReviewDTO> >(_reviewsRepository.GetAllReviewsByUserId(UserId));

            foreach (var item in reviewsList)
            {
                if (item.ContentType == ContentType.Movie)
                {
                    item.FilmImage = _moviesService.GetMovieById(item.FilmId).ImageSource;
                }
                else if (item.ContentType == ContentType.Serial)
                {
                    item.FilmImage = _serialsService.GetSerialById(item.FilmId).PosterImageSource;
                }
            }
            var reviewsListPaged = paginateQuery(reviewsList, sortState, PageNumber, PageSize);

            return(new Entities.Models.IPagedResponse <ReviewDTO>(reviewsListPaged)
            {
                PageSize = PageSize,
                TotalCount = reviewsList.Count(),
                PageNumber = PageNumber,
                Data = reviewsListPaged
            });
        }
Exemplo n.º 2
0
        public IActionResult GetSerial(int id)
        {
            SerialDTO objectList = _serialsService.GetSerialById(id);

            return(Ok(objectList));
        }