public ActionResult Index(int?page) { int pageIndex = PagingHelper.GetPageIndex(page); WorkAndRestSearchModel q = new WorkAndRestSearchModel(); IWorkAndRestService wrs = new WorkAndRestService(Settings.Default.db); IPagedList <WorkAndRest> workAndRests = wrs.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; SetWorkAndRestTypeList(null); return(View(workAndRests)); }
public ActionResult Search([Bind(Include = "DateAtFrom,DateAtTo, DateType")] WorkAndRestSearchModel q) { int pageIndex = 0; int.TryParse(Request.QueryString.Get("page"), out pageIndex); pageIndex = PagingHelper.GetPageIndex(pageIndex); IWorkAndRestService ss = new WorkAndRestService(Settings.Default.db); IPagedList <WorkAndRest> workAndRests = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; SetWorkAndRestTypeList(q.DateType); return(View("Index", workAndRests)); }
public IQueryable <WorkAndRest> Search(WorkAndRestSearchModel searchModel) { IQueryable <WorkAndRest> workAndRests = this.context.WorkAndRest; if (searchModel.DateAtFrom.HasValue) { workAndRests = workAndRests.Where(c => c.dateAt >= searchModel.DateAtFrom); } if (searchModel.DateAtTo.HasValue) { workAndRests = workAndRests.Where(c => c.dateAt <= searchModel.DateAtTo); } if (searchModel.DateType.HasValue) { workAndRests = workAndRests.Where(c => c.dateType.Equals(searchModel.DateType)); } return(workAndRests.OrderBy(c => c.dateAt)); }
public IQueryable <WorkAndRest> Search(WorkAndRestSearchModel searchModel) { return(workAndRestRep.Search(searchModel)); }