public ActionResult Index(string allOrUnread = "unread", int?page = null) { ViewBag.allOrUnread = allOrUnread; MessageRecordSearchModel q = new MessageRecordSearchModel(); int pageIndex = PagingHelper.GetPageIndex(page); IMessageRecordService mrs = new MessageRecordService(Settings.Default.db); IPagedList <MessageRecordView> records = mrs .GetByCateAndAllOrUnread(MessageRecordCatetory.Alert, (allOrUnread == "all" ? true : false)) .ToPagedList <MessageRecordView>(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; return(View(records)); }
public ActionResult Search([Bind(Include = "StaffNr,StaffNrAct")] MessageRecordSearchModel q) { string allOrUnread = Request.QueryString["allOrUnread"]; ViewBag.allOrUnread = allOrUnread; int pageIndex = 0; int.TryParse(Request.QueryString.Get("page"), out pageIndex); pageIndex = PagingHelper.GetPageIndex(pageIndex); IMessageRecordService mrs = new MessageRecordService(Settings.Default.db); IPagedList <MessageRecordView> records = mrs .GetByCateAndAllOrUnread(MessageRecordCatetory.Alert, (allOrUnread == "all" ? true : false), q) .ToPagedList <MessageRecordView>(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; return(View("Index", records)); }