public IActionResult UrlDatasource([FromBody] DataManagerRequest dm)
        {
            EFDataContext          db         = new EFDataContext();
            IQueryable <Customers> DataSource = db.customers;
            QueryableOperation     operation  = new QueryableOperation();

            if (dm.Search != null && dm.Search.Count > 0)
            {
                DataSource = operation.PerformSearching(DataSource, dm.Search); //Search
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0)                       //Sorting
            {
                DataSource = operation.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            int count = DataSource.Count();

            if (dm.Skip != 0)
            {
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging
            }
            if (dm.Take != 0)
            {
                DataSource = operation.PerformTake(DataSource, dm.Take);
            }
            return(dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource));
        }
Exemple #2
0
 public static IEnumerable <T> PerformSorting <T>(
     IEnumerable <T> dataSource,
     List <Sort> sortedColumns)
 {
     return((IEnumerable <T>)QueryableOperation.PerformSorting <T>(dataSource.AsQueryable <T>(), sortedColumns));
 }
Exemple #3
0
 public static IQueryable <T> PerformSorting <T>(
     IQueryable <T> dataSource,
     List <Sort> sortedColumns)
 {
     return(QueryableOperation.PerformSorting <T>(dataSource, sortedColumns));
 }