public IActionResult Create([FromBody] PostReviewDTO postReview) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var isCreated = _reviewService.Create(userId, postReview); if (isCreated) { return(Ok()); } return(BadRequest()); }
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); }