Example #1
0
        public IActionResult GetReviewer(int reviewerId)
        {
            if (!_reviewerRepository.ReviewerExists(reviewerId))
            {
                return(NotFound());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var reviewer    = _reviewerRepository.GetReviewer(reviewerId);
            var reviewerDto = new ReviewerDto()
            {
                Id        = reviewer.Id,
                FirstName = reviewer.FirstName,
                LastName  = reviewer.LastName
            };

            return(Ok(reviewerDto));
        }
        public IActionResult GetReviewerOfReview(int reviewId)
        {
            if (!_reviewerRepo.isExists(reviewId))
            {
                return(NotFound());
            }

            var reviewer = _reviewerRepo.GetReviewerOfReview(reviewId);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var reviewerDto = new ReviewerDto
            {
                Id        = reviewer.Id,
                FirstName = reviewer.FirstName,
                LastName  = reviewer.LastName
            };

            return(Ok(reviewerDto));
        }