public ActionResult Index(string searchKey, DateTime?fromDate, DateTime?toDate, int?pageIndex) { var model = _Service.All(searchKey, fromDate, false, toDate, pageIndex, 20); int totalPage = model?.Total ?? 0; ViewBag.TotalPage = totalPage; ViewBag.pageIndex = pageIndex ?? 1; ViewBag.SearchKey = string.IsNullOrWhiteSpace(searchKey) ? string.Empty : searchKey; ViewBag.FromDate = fromDate?.ToString("MM/dd/yyyy") ?? null; ViewBag.ToDate = toDate?.ToString("MM/dd/yyyy") ?? null; ViewBag.Quanlyvanban = "active"; return(View(model?.Documents ?? new List <Document>())); }