PegedList with more than one class

0

I have three tables mapped with the Entity Framework: teachers, classes, and enrollments. I need to show some fields of the teachers and some fields of the classes and show the result in a view using a PagedList if I put it in the following way I get this error:

Error CS1061 'GroupReport' does not contain a definition for 'ToPagedList' and no extension method 'ToPagedList' accepting a first argument of type 'GroupReport' could be found (missing a using directive or an assembly reference?)

using colegio.Datos;
using colegio.Models;
using PagedList;

public ActionResult Index(int? page)
        {
            const int pageSize = 20;
            int pageNumber = (page ?? 1);

            var clases = db.claseTs.Include(t => t.aulaT);

            var maestros = db.maestroTs.Include(t => t.alumnoT);

            var inscripciones = db.inscripcionTs.Include(t => t.membresiaT);

            var grupo = new GruopReport();
            grupo.clasesT = clases.ToList();
            grupo.maestrosT = maestros.ToList();
            grupo.inscripcionT = inscripciones.ToList();

            return View(grupo.ToPagedList(pageNumber, pageSize));


        }
    
asked by senseilex 04.03.2018 в 23:26
source

1 answer

0

GruopReport you are declaring it as an object and not as a list ... a simple object can not be paged. I do not understand what he wants to do, but it is likely that you will have to paginate the lists that you recover, but this is very with tweezers because I do not know what the view is.

for example like this:

        var grupo = new GruopReport();
        grupo.clasesT = clases.ToPagedList(pageNumber, pageSize);
        grupo.maestrosT = maestros.ToPagedList(pageNumber, pageSize);
        grupo.inscripcionT = inscripciones.ToPagedList(pageNumber, pageSize);

        return View(grupo);
    
answered by 18.03.2018 в 23:21