public HttpResponseMessage GetData(HttpRequestMessage request) { //System.Threading.Thread.Sleep(5000); string queryString = HttpUtility.UrlDecode(request.Content.ReadAsStringAsync().Result); var data = HttpUtility.ParseQueryString(queryString); int filteredCount; var requestData = DataTableRequest.Parse(data); var people = peopleService.GetPeople( requestData.Start, requestData.Length, requestData.Search.Value, requestData.GetFilters(), requestData.Order.ToDictionary( o => o.Column, o => o.Dir == DataTableOrderDirection.Asc ? 1 : -1), out filteredCount); var response = new DataTableResponse <Person> { Draw = requestData.Draw, RecordsTotal = peopleService.GetTotalPeople(), RecordsFiltered = filteredCount, DataItems = people }; return(request.CreateResponse(HttpStatusCode.OK, response)); }
internal static DataTableResult DataTableJson <T>(NameValueCollection request, List <T> list, Func <string, object, object> formatter, params Expression <Func <T, object> >[] col) { return(DataTableJson <T>(DataTableRequest.Parse(request), list, formatter, col)); }