public async Task <IActionResult> Index(string searchString, int?page) { HttpContext.Session.SetString("Authorize", "False"); if (searchString != null) { page = 1; } IQueryable <Models.Entities.File> file = from m in _context.FileTable.Where(p => p.State == true) select m; if (!String.IsNullOrEmpty(searchString)) { file = file.Where(s => s.CourseName.Contains(searchString)); } int pageSize = 15; return(View(await HomepagePaginationViewModel <Models.Entities.File> .CreateAsync( file.AsNoTracking(), page ?? 1, pageSize))); }
// GET: Account public async Task <IActionResult> Index(string searchString, int?page) { if (HttpContext.Session.GetInt32("UserId") == null || HttpContext.Session.GetInt32("UserId") == 0) { return(RedirectToAction("Index", "Home")); } if (searchString != null) { page = 1; } IQueryable <Models.Entities.File> file = from m in _context.FileTable.Where(p => p.State == true) select m; if (!String.IsNullOrEmpty(searchString)) { file = file.Where(s => s.CourseName.Contains(searchString)); } int pageSize = 15; return(View(await HomepagePaginationViewModel <Models.Entities.File> .CreateAsync( file.AsNoTracking(), page ?? 1, pageSize))); }