public ActionResult DataEmpleado(Syncfusion.JavaScript.DataManager dm) { DataResultEmpleado result = new DataResultEmpleado(); Syncfusion.JavaScript.DataSources.DataOperations dataOperations = new Syncfusion.JavaScript.DataSources.DataOperations(); result.result = context.Empleados.Include(e => e.Departamento).Include(e => e.Sexo).Include(e => e.EstadoCivil).ToList(); if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting { result.result = dataOperations.PerformSorting(result.result, dm.Sorted); } if (dm.Where != null && dm.Where.Count > 0) //Filtering { result.result = dataOperations.PerformWhereFilter(result.result, dm.Where, dm.Where[0].Operator); if (!dm.RequiresCounts) { return(Json(result.result)); } } result.count = context.Empleados.Include(e => e.Departamento).Include(e => e.Sexo).Include(e => e.EstadoCivil).AsQueryable().Count(); if (dm.Skip != 0) { result.result = dataOperations.PerformSkip(result.result, dm.Skip); } if (dm.Take != 0) { result.result = dataOperations.PerformTake(result.result, dm.Take); } return(Json(new { result = result.result, count = result.count }, JsonRequestBehavior.AllowGet)); }
public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) { DataResult result = new DataResult(); Syncfusion.JavaScript.DataSources.DataOperations dataOperations = new Syncfusion.JavaScript.DataSources.DataOperations(); result.result = context.Albums.Include(a => a.Artista).Include(a => a.Genero).ToList(); if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting { result.result = dataOperations.PerformSorting(result.result, dm.Sorted); } if (dm.Where != null && dm.Where.Count > 0) //Filtering { result.result = dataOperations.PerformWhereFilter(result.result, dm.Where, dm.Where[0].Operator); if (!dm.RequiresCounts) { return(Json(result.result)); } } result.count = context.Albums.Include(a => a.Artista).Include(a => a.Genero).AsQueryable().Count(); if (dm.Skip != 0) { result.result = dataOperations.PerformSkip(result.result, dm.Skip); } if (dm.Take != 0) { result.result = dataOperations.PerformTake(result.result, dm.Take); } if (dm.Search != null) { result.result = dataOperations.PerformSearching(result.result, dm.Search); } return(Json(new { result = result.result, count = result.count }, JsonRequestBehavior.AllowGet)); }