public JobTitleInfoModel GetJobTitleInfo(JobTitleSearchModel searchModel) { JobTitleInfoModel info = new JobTitleInfoModel(); DataContext dc = new DataContext(this.DbString); IJobTitleRepository jobTitleRep = new JobTitleRepository(dc); IQueryable <JobTitle> jobTitles = jobTitleRep.Search(searchModel); info.jobTitleCount = dc.Context.GetTable <JobTitle>().Where(c => c.id.Equals(jobTitles.Count() > 0 ? jobTitles.First().id : -1)).Count(); return(info); }
public ActionResult Index(int?page) { int pageIndex = PagingHelper.GetPageIndex(page); JobTitleSearchModel q = new JobTitleSearchModel(); IJobTitleService ss = new JobTitleService(Settings.Default.db); IPagedList <JobTitle> jobTitles = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; JobTitleInfoModel info = ss.GetJobTitleInfo(q); ViewBag.Info = info; return(View(jobTitles)); }