// GET: MuonTra public ActionResult Index(int?pageIndex, int?pageSize, string searchString, bool active = true) { pageIndex = (pageIndex ?? 1); pageSize = pageSize ?? GlobalConfigs.DEFAULT_PAGESIZE; var model = new MuonTraIndexViewModel() { PageIndex = pageIndex.Value, PageSize = pageSize.Value }; var listMuonTra = _muonTraService.GetAllHaveJoinUser(); listMuonTra = listMuonTra.Where(p => p.TinhTrang == EnumTinhTrang.DaTra); var muontras = _muonTraService.GetAllPaged(listMuonTra, pageIndex, pageSize.Value, p => p.TrangThai == active, p => p.OrderBy(c => c.NgayMuon)); if (!string.IsNullOrEmpty(searchString)) { muontras = _muonTraService.GetAllPaged(listMuonTra, pageIndex, pageSize.Value, p => p.User.FullName.Contains(searchString) || p.ChiTietMuonTras.FirstOrDefault().TaiLieuVanBan.Ten.Contains(searchString) || p.VanThu.Contains(searchString) && p.TrangThai == active, p => p.OrderBy(c => c.NgayMuon)); } model.Paged = muontras; model.Items = GetMuonTras(muontras.ToList()); ViewBag.Active = active; ViewBag.searchString = searchString; ViewBag.Controller = "Tra"; ViewBag.TinhTrang = EnumTinhTrang.DaTra.GetDecription(); return(View(model)); }
public List <MuonTra> GetUsersBorrowDocument() { var list = _muonTraService.GetAllHaveJoinUser(); var users = list.Where(p => p.NgayKetThuc < DateTime.Now && p.TinhTrang == EnumTinhTrang.DangMuon && p.TrangThai == true); return(users.ToList()); }