public PageResult<Order> Get(ODataQueryOptions opts)
{
List<Order> emp = db.Orders.ToList();
var count = 0;
var results = emp.AsQueryable();
if (opts.InlineCount != null)
count = results.Count();
if (opts.Filter != null)
{
results = opts.Filter.ApplyTo(results, newODataQuerySettings()).Cast<Order>();
count = results.Count();
return new PageResult<Order>(results, null, count);
}
else
return new PageResult<Order>(opts.ApplyTo(emp.AsQueryable()) asIEnumerable<Order>, null, count);
} |
[ValuesController.cs]
public PageResult<EditableOrder> Get(ODataQueryOptions opts)
{
var data = OrderRepository.GetAllRecords().ToList();
var count = 0;
var result = data.AsQueryable();
if (opts.InlineCount != null)
count = result.Count();
if (opts.Filter != null)
{
result = opts.Filter.ApplyTo(result, newODataQuerySettings()).Cast<EditableOrder>();
count = result.Count();
return new PageResult<EditableOrder>(result, null, count);
}
else
return new PageResult<EditableOrder>(opts.ApplyTo(result.AsQueryable()) as IEnumerable<EditableOrder>, null, count);
} |
public PageResult<_30000Record> Get(ODataQueryOptions opts)
{
var data = db._30000Records;
var count = 0;
IEnumerable<_30000Record> result = null;
if (opts.InlineCount != null)
count = data.Count();
if (opts.Filter != null)
{
result = opts.Filter.ApplyTo(data, new ODataQuerySettings()).Cast<_30000Record>();
count = result.Count();
return new PageResult<_30000Record>(result, null, count);
}
else
return new PageResult<_30000Record>(opts.ApplyTo(data.AsQueryable()) as IEnumerable<_30000Record>, null, count);
}
|
<script>
function btnClick() {
$("#EmployeesGrid").ejGrid({ pageSettings: { currentPage: 1 } });
$("#EmployeesGrid").ejGrid({ dataSource: ej.DataManager({ url: "api/Values", adaptor: new ej.WebApiAdaptor() }) });
}
</script> |
<script>
function btnClick() {
$("#EmployeesGrid").ejGrid("dataSource", ej.DataManager({ url: "api/Values", adaptor: new ej.WebApiAdaptor() }) );
}
</script> |