public IActionResult Index(LibrarySeatSearchArgs args, int page = 1, int size = 20) { var dataSource = _librarySeatService.searchSeat(args, page, size); var pageList = dataSource.toDataSourceResult <Entities.LibrarySeat, LibrarySeatSearchArgs>("librarySeatIndex", args); return(View(pageList)); }
public IPagedList <Entities.LibrarySeat> searchSeat(LibrarySeatSearchArgs args, int page, int size) { var query = _librarySeatRepository.Table; if (args != null) { if (!String.IsNullOrEmpty(args.q)) { int seatnum; bool isInt = int.TryParse(args.q, out seatnum); if (isInt) { query = query.Where(o => o.SeatNumber == seatnum); } } } query = from e in query orderby e.SeatNumber select e; return(new PagedList <Entities.LibrarySeat>(query, page, size)); }