Esempio n. 1
0
        public IActionResult Create([FromBody] PostReviewDTO postReview)
        {
            var userId    = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var isCreated = _reviewService.Create(userId, postReview);

            if (isCreated)
            {
                return(Ok());
            }
            return(BadRequest());
        }
Esempio n. 2
0
        public bool Create(string userId, PostReviewDTO reviewDTO)
        {
            bool isCreated = true;

            if (reviewDTO == null || userId == null)
            {
                isCreated = false;
                return(isCreated);
            }
            Review review = new Review
            {
                Id      = Guid.NewGuid().ToString(),
                MovieId = reviewDTO.MovieId,
                UserId  = userId,
                Content = reviewDTO.Content
            };

            _reviewRepository.Create(review);
            return(isCreated);
        }