Пример #1
0
        public ActionResult Tag(string tagId, int?page, int pageSize = 10)
        {
            var currentPage = page ?? 1;
            var contentDao  = new ContentDao();
            var model       = contentDao.GetAllContentByTag(tagId, currentPage, pageSize);
            int totalRecord = 0;

            ViewBag.Tag = new ContentDao().GetTag(tagId);

            ViewBag.TotalRecord = totalRecord;
            ViewBag.Page        = page;
            ViewBag.MaxPage     = 5;
            var totalPage = (int)Math.Ceiling((double)(totalRecord / pageSize));

            ViewBag.TotalPage = totalPage;

            ViewBag.First = 1;
            ViewBag.Last  = totalPage;

            ViewBag.NextPage     = page + 1;
            ViewBag.PreviousPage = page - 1;

            return(View(model));
        }