Exemplo n.º 1
0
        // Notices
        public ActionResult Notices(int pageIndex = 1, int?category = null)
        {
            int pageSize = 4;

            int totalRecords         = 0;
            int totalFilteredRecords = 0;

            List <Notice> result = DataProvider
                                   .GetNotices <Notice>
                                   (
                out totalRecords,
                out totalFilteredRecords,
                new DbParameters <Notice>
            {
                PageIndex = pageIndex,
                PageSize  = pageSize,
                SortOrder = "desc",
                Filters   = category != null ? new Notice {
                    CategoryId = (int)category
                } : null,
            }
                                   )
                                   .ToList();

            NoticePageViewModel model = new NoticePageViewModel
            {
                Notices    = result,
                PageCount  = (totalFilteredRecords > pageSize ? (int)Math.Ceiling((decimal)totalFilteredRecords / pageSize) : 1),
                PageInex   = pageIndex,
                CategoryId = category
            };

            return(View(model));
        }
Exemplo n.º 2
0
 private IActionResult Notice(NoticePageViewModel vm)
 {
     return(this.View("Notice", vm));
 }