private List <Instruction> SortInstruction(ApplicationDbContext db, string nameClass) { ISorting classSort = Activator.CreateInstance(Type.GetType(nameClass)) as ISorting; List <Instruction> instructions = db.Instructions.ToList(); return((classSort.Sorting(instructions)).Take(5).ToList()); }
private List <Instruction> ImplementInterfaceBySort(IQueryable <Instruction> instr, int itemsToSkip) { List <Instruction> listInstr; if (Session["classSort"] != null) { ISorting s = Session["classSort"] as ISorting; listInstr = s.Sorting(instr.ToList()); if (itemsToSkip + 5 >= listInstr.Count) { Session["classSort"] = null; } } else { listInstr = instr.ToList(); } return(listInstr); }