I'm getting this error on this method:
[HttpGet]
public HttpResponseMessage Search([ModelBinder(typeof(ApiDataTablesModelBinder))] IDataTablesRequest requestModel)
{
var sortedColumn = requestModel.Columns.GetSortedColumns().SingleOrDefault();
bool isDesc = false;
string sortField = "ID";
// get all projects and order them
var projects = lkp_surveyRepo.GetAll();//.OrderBy(sortField, isDesc).ToList();
// filtered projects
var filteredResults = projects;
filteredResults = projects.Where(x => x.code == selectedDistrictID);
var pagedResults = filteredResults.Skip(requestModel.Start).Take(requestModel.Length);
var result = Request.CreateResponse(HttpStatusCode.OK, new DataTablesResponse(requestModel.Draw, pagedResults, filteredResults.Count(), projects.Count()));
return result;
}
my controller is implementing Controller:
public class HomeController : Controller
{
I found this question, but the answer didn't help me:
CreateResponse method in asp.net Web API
complete error is:
Error 13 'System.Web.HttpRequestBase' does not contain a definition for 'CreateResponse' and the best extension method overload 'System.Net.Http.HttpRequestMessageExtensions.CreateResponse(System.Net.Http.HttpRequestMessage, System.Net.HttpStatusCode, T)' has some invalid arguments
do you see what I'm doing wrong? maybe something wrong with whats inside the CreateResponse
method... thanks