public HttpResponseMessage Get(int resourceId, string sort, int count) { IEnumerable <dynamic> resourceList = resourceRepository.GetResourceByIdAndSortAndCount(resourceId, sort, count); var data = ResourceToJsonRepository.GetData(resourceList, count); JavaScriptSerializer serializer = new JavaScriptSerializer(); string str = serializer.Serialize(data); return(new HttpResponseMessage { Content = new StringContent(str, Encoding.UTF8, "application/json") }); }
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") }); }
public HttpResponseMessage Get(int videoId) { resourceRepository.UpdateClick(videoId); resourceRepository.UpdateAverage(); IEnumerable <dynamic> dynamics = resourceRepository.GetResourceById(videoId); Resource data = ResourceToJsonRepository.ToList(dynamics); JavaScriptSerializer serializer = new JavaScriptSerializer(); string str = serializer.Serialize(data); return(new HttpResponseMessage { Content = new StringContent(str, Encoding.UTF8, "application/json") }); }