Example #1
0
        public ExtraWorkRecordInfoModel GetExtraWorkRecordInfo(ExtraWorkRecordSearchModel searchModel)
        {
            ExtraWorkRecordInfoModel info = new ExtraWorkRecordInfoModel();
            DataContext dc = new DataContext(this.DbString);
            IExtraWorkRecordRepository   rep     = new ExtraWorkRecordRepository(dc);
            IQueryable <ExtraWorkRecord> results = rep.Search(searchModel);

            info.extraWorkRecordCount = dc.Context.GetTable <ExtraWorkRecord>().Where(c => c.id.Equals(results.Count() > 0 ? results.First().id : -1)).Count();

            return(info);
        }
        public ActionResult Index(int?page)
        {
            SetDropDownList(null);

            int pageIndex = PagingHelper.GetPageIndex(page);

            ExtraWorkRecordSearchModel q = new ExtraWorkRecordSearchModel();

            IExtraWorkRecordService ss = new ExtraWorkRecordService(Settings.Default.db);

            IPagedList <ExtraWorkRecord> models = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize);

            ViewBag.Query = q;

            ExtraWorkRecordInfoModel info = ss.GetExtraWorkRecordInfo(q);

            ViewBag.Info = info;

            return(View(models));
        }