//顯示該"評論者"詳細狀況,評論的"書籍"及"內容"
        public async Task <ActionResult> GetReviewerById(int reviewerId)
        {
            //欲顯示reviewer 以及其每則review跟所評論的Book
            var reviewer = await _reviewerRepository.GetReviewerById(reviewerId);

            if (reviewer == null)
            {
                ViewBag.Message = $"Did not have {reviewerId}'s Id reviewer";
                ModelState.AddModelError("", "Some Error getting reviewer");
                reviewer = new ReviewerDto();
            }
            IDictionary <ReviewDto, BookDto> reviewAndBook = new Dictionary <ReviewDto, BookDto>();

            var reviews = await _reviewerRepository.GetReviewsByAReviewer(reviewer.Id);

            foreach (var review in reviews)
            {
                var book = await _reviewRepository.GetBookForAReview(review.Id);

                reviewAndBook.Add(review, book);
            }

            var reviewerDetail = new ReviewerDetailViewModel
            {
                Reviewer      = reviewer,
                ReviewAndBook = reviewAndBook
            };

            return(View(reviewerDetail));
        }
        public IActionResult GetReviewerById(int reviewerId)
        {
            var reviewer = _reviewerRepository.GetReviewerById(reviewerId);

            if (reviewer == null)
            {
                ModelState.AddModelError("", "Error getting a reviewer");
                ViewBag.Reviewer = $"There was a problem retrieving reviewer with Id={reviewerId} " +
                                   $"from the database or no reviewer with this id exists";
                reviewer = new ReviewerDto();
            }

            var reviews = _reviewerRepository.GetReviewsByAReviewer(reviewerId);

            if (reviews.Count() <= 0)
            {
                ViewBag.ReviewsMessage = $"Reviewer {reviewer.FirstName} {reviewer.LastName} " +
                                         $"has no any reviews at this time, please come back later";
            }

            IDictionary <ReviewDto, BookDto> reviewAndBook = new Dictionary <ReviewDto, BookDto>();

            foreach (var review in reviews)
            {
                var book = _reviewRepository.GetBookOfAReview(review.Id);
                reviewAndBook.Add(review, book);
            }

            var reviewerReviewsBooksViewModel = new ReviewerReviewsBooksViewModel()
            {
                Reviewer   = reviewer,
                ReviewBook = reviewAndBook
            };

            return(View(reviewerReviewsBooksViewModel));
        }