public StaffTypeInfoModel GetStaffTypeInfo(StaffTypeSearchModel searchModel) { StaffTypeInfoModel info = new StaffTypeInfoModel(); DataContext dc = new DataContext(this.DbString); IStaffTypeRepository staffTypeRep = new StaffTypeRepository(dc); IQueryable <StaffType> staffTypes = staffTypeRep.Search(searchModel); info.staffTypeCount = dc.Context.GetTable <JobTitle>().Where(c => c.id.Equals(staffTypes.Count() > 0 ? staffTypes.First().id : -1)).Count(); return(info); }
public ActionResult Index(int?page) { int pageIndex = PagingHelper.GetPageIndex(page); StaffTypeSearchModel q = new StaffTypeSearchModel(); IStaffTypeService ss = new StaffTypeService(Settings.Default.db); IPagedList <StaffType> staffTypes = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; StaffTypeInfoModel info = ss.GetStaffTypeInfo(q); ViewBag.Info = info; return(View(staffTypes)); }