コード例 #1
0
ファイル: NewsController.cs プロジェクト: 080779/NewSDMS
        public PartialViewResult ReadListGetPage(long id, string name, DateTime?startTime, DateTime?endTime, int pageIndex = 1)
        {
            int pageSize             = 3;
            ReadListViewModel model  = new ReadListViewModel();
            ReadSearchResult  result = readNumberService.GetPageList(id, name, startTime, endTime, pageIndex, pageSize);

            model.ReadNumbers = result.ReadNumbers;

            //分页
            Pagination pager = new Pagination();

            pager.PageIndex  = pageIndex;
            pager.PageSize   = pageSize;
            pager.TotalCount = result.TotalCount;

            if (result.TotalCount <= pageSize)
            {
                model.Page = "";
            }
            else
            {
                model.Page = pager.GetPagerHtml();
            }
            return(PartialView("ReadListPaging", model));
        }
コード例 #2
0
        public ActionResult Read(int id)
        {
            var TrainingPublication = _db.TrainingPublications.Find(id);

            if (TrainingPublication == null || TrainingPublication.Status != "Current")
            {
                ViewBag.ErrorMessage = "Manuscript not found.";
                return(View("Error"));
            }

            var ReadListVM = new ReadListViewModel
            {
                RecordID    = id,
                PaperNumber = TrainingPublication.TrainingPublicationNumber.ToString(),
                Files       = TrainingPublication.TrainingDocuments.Where(pd => pd.Status == "Current").Select(pd => new ReadViewModel
                {
                    TrainingDocumentID = pd.TrainingDocumentID,
                    FileName           = pd.FileName,
                    FileType           = pd.FileType,
                    FileUrl            = pd.FileUrl
                }).ToList()
            };

            return(View(ReadListVM));
        }