public async Task <DatatablesPagedResults <TEntity> > DatatablesAsync(DatatablesParameter parameter, ISpecificationQuery <TEntity> spec) { var source = GetAll(); TEntity[] items; source = DatatablesHelper.SearchData(source, parameter); source = DatatablesHelper.SortData(source, parameter); var size = await source.CountAsync(); if (parameter.Length > 0) { items = await source .Skip((parameter.Start / parameter.Length) *parameter.Length) .Take(parameter.Length) .ToArrayAsync(); } else { items = await source .ToArrayAsync(); } return(new DatatablesPagedResults <TEntity> { Items = items, TotalSize = size }); }
/// <summary> /// Create plugin options /// </summary> /// <param name="nullValues">Null value handling</param> /// <returns>Plugin options</returns> public virtual IDictionary <string, object> CreateOptions(NullValueHandling nullValues) { Type[] converterTypes; IDictionary <string, object> options = DatatablesHelper.ToDictionary(this, nullValues, out converterTypes); var converters = converterTypes.Distinct().Select(c => (JsonConverter)Activator.CreateInstance(c)); CustomConverters.AddRange(converters); return(options); }
public LancamentoController(DatatablesHelper datatablesHelper, BackendProxy proxy) : base(proxy) { _datatablesHelper = datatablesHelper; }
public AtalhoController(DatatablesHelper datatablesHelper, BackendProxy proxy) : base(proxy) { _datatablesHelper = datatablesHelper; }
/// <summary> /// Create options /// </summary> /// <param name="nullValues">Null value handling</param> /// <returns>Plugin options</returns> public virtual IDictionary <string, object> CreateOptions(NullValueHandling nullValues) { IDictionary <string, object> options = DatatablesHelper.ToDictionary(this, nullValues); return(options); }
public CategoriaController(DatatablesHelper datatablesHelper, BackendProxy proxy) : base(proxy) { _datatablesHelper = datatablesHelper; }