public CertificateTypeInfoModel GetCertificateTypeInfo(CertificateTypeSearchModel searchModel) { CertificateTypeInfoModel info = new CertificateTypeInfoModel(); DataContext dc = new DataContext(this.DbString); ICertificateTypeRepository certfRep = new CertificateTypeRepository(dc); IQueryable <CertificateType> certfs = certfRep.Search(searchModel); info.certfCount = dc.Context.GetTable <CertificateType>().Where(c => c.id.Equals(certfs.Count() > 0 ? certfs.First().id : -1)).Count(); return(info); }
public ActionResult Index(int?page) { int pageIndex = PagingHelper.GetPageIndex(page); CertificateTypeSearchModel q = new CertificateTypeSearchModel(); ICertificateTypeService ss = new CertificateTypeService(Settings.Default.db); IPagedList <CertificateType> certfs = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; CertificateTypeInfoModel info = ss.GetCertificateTypeInfo(q); ViewBag.Info = info; return(View(certfs)); }