Beispiel #1
0
        // GET: api/Review
        public HttpResponseMessage Get(int resourceId, int pageIndex)
        {
            IEnumerable <dynamic> reviewList = reviewRepository.GetReviewById(resourceId, pageIndex);
            IEnumerable <dynamic> dynamics   = reviewRepository.GetAVGGrade(resourceId);
            int totalCount = reviewRepository.GetCount(resourceId);
            var data       = ReviewToJsonRepository.GetData(reviewList, totalCount, dynamics);
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string str = serializer.Serialize(data);

            return(new HttpResponseMessage {
                Content = new StringContent(str, Encoding.UTF8, "application/json")
            });
        }