Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        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));
        }