Ejemplo n.º 1
0
        public async Task <IActionResult> GetCommentsOnMovie(string movieId)
        {
            var userId = User.GetUserId();

            if (userId == null)
            {
                return(BadRequest(new { message = "User is not authenticated" }));
            }

            var comments = await _service.AllCommentsForMovie(movieId);

            var movieComments = _mapper.Map <ICollection <Comment>, List <CommentGetOnMovieDto> >(comments);

            return(Ok(movieComments));
        }