Exemplo n.º 1
0
        public async Task <PartialViewResult> OnGetTabla(int?Id, int?Pagina, int?Maximo)
        {
            if (Pagina != null)
            {
                this.Pagina = Pagina.Value;
            }
            if (Maximo != null)
            {
                this.Maximo = Maximo.Value;
            }
            this.Marcas = _context.Marcas.ToList();
            var total = _context.Marcas.Select(
                q => new
            {
                co = Marcas.Count()
            }
                ).FirstOrDefault();

            this.Total  = total.co;
            this.Marcas = _context.Marcas.
                          Skip((this.Pagina.Value) * this.Maximo.Value).Take(this.Maximo.Value).ToList();

            if (Id != null)
            {
                this.Marca = await _context.Marcas.FirstOrDefaultAsync(c => c.Id == Id);
            }
            return(Partial("/Pages/Shared/OthersPartials/_TablaMarcasPartial.cshtml", this));
        }