public Task BindModelAsync(ModelBindingContext bindingContext) { string controllerName = bindingContext.ActionContext.ActionDescriptor.RouteValues["controller"]; string actionName = bindingContext.ActionContext.ActionDescriptor.RouteValues["action"]; DataTablesConfiguration configuration = dataTablesService.GetConfiguration(controllerName, actionName); bindingContext.Result = ModelBindingResult.Success(configuration); return(Task.CompletedTask); }
public Task BindModelAsync(ModelBindingContext bindingContext) { var request = bindingContext.HttpContext.Request; IFormCollection value = request.HasFormContentType ? request.Form : FormCollection.Empty; string controllerName = bindingContext.ActionContext.ActionDescriptor.RouteValues["controller"]; string actionName = bindingContext.ActionContext.ActionDescriptor.RouteValues["action"]; DataTablesConfiguration configuration = dataTablesService.GetConfiguration(controllerName, actionName); var inputModel = DataTablesInputModel.FromFormCollection(value, configuration); bindingContext.Result = ModelBindingResult.Success(inputModel); return(Task.CompletedTask); }