Created
September 21, 2014 18:38
-
-
Save hikalkan/58b2eb983e7b7dae0d1b to your computer and use it in GitHub Desktop.
Working Kendo with ABP sample codes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a base class for common parameters | |
public class KendoInputDto : IInputDto | |
{ | |
public int Take { get; set; } | |
public int Skip { get; set; } | |
public IEnumerable<Sort> Sort { get; set; } | |
public Filter Filter { get; set; } | |
} | |
//So you can derive from it: | |
public class GetTaskListInput : KendoInputDto | |
{ | |
// remaining properties omitted... | |
} | |
//-------------------------- | |
//Create an extension method: | |
public static class MyExtensions | |
{ | |
public static DataSourceResult ToDataSourceResult(this IQueryable query, KendoInputDto input) | |
{ | |
return query.ToDataSourceResult(input.Take, input.Skip, input.Sort, input.Filter); | |
} | |
} | |
//Then use it to easily generate DataSourceResult: | |
public DataSourceResult GetTaskList(GetTaskListInput getTaskListInput) | |
{ | |
var myquery = build an IQueryable... | |
return myquery.ToDataSourceResult(getTaskListInput); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment