Пример #1
0
        public HttpResponseMessage Get(string sort, int pageIndex)
        {
            int totalCount = resourceRepository.GetCount(sort);
            IEnumerable <dynamic> resourceList = resourceRepository.PaginationBySort(sort, pageIndex);
            var data = ResourceToJsonRepository.GetData(resourceList, totalCount);
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string str = serializer.Serialize(data);

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