Exemplo n.º 1
0
        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
            });
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 public LancamentoController(DatatablesHelper datatablesHelper, BackendProxy proxy)
     : base(proxy)
 {
     _datatablesHelper = datatablesHelper;
 }
Exemplo n.º 4
0
 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);
        }
Exemplo n.º 6
0
 public CategoriaController(DatatablesHelper datatablesHelper, BackendProxy proxy)
     : base(proxy)
 {
     _datatablesHelper = datatablesHelper;
 }