コード例 #1
0
        public ActionResult GetByCategory(string category, int page)
        {
            int totalTourByCategory = _tourRepository.GetByCategory(category).Count();

            if (page <= 0)
            {
                page = 1;
            }

            var totalPage = (int)Math.Ceiling(totalTourByCategory / (double)size);

            ViewBag.TotalPage       = totalPage;
            ViewBag.CurrentPage     = page;
            ViewBag.CurrentCategory = category;

            var tours = _tourRepository.GetToursByCategoryWithPaging(category, page, size);

            return(View(tours));
        }