Beispiel #1
0
        public ActionResult Index()
        {
            var articleController = new TMV.Data.Entities.ArticleController();

            ViewBag.DichVuNoiBat  = articleController.GetArticle(827).Intro;
            ViewBag.TaiSaoNenChon = articleController.GetArticle(826).Intro;
            //ViewBag.LineTitle = "Trang chủ";
            return(View());
        }
Beispiel #2
0
        public ActionResult Category(string categorySlug = "", int page = 1)
        {
            var isMobile    = MvcApplication.IsMobileMode();
            var objCategory = new CategoryController().GetCategoryBySlug(categorySlug, _isClearCache);

            if (objCategory.CategoryId == -1)
            {
                return(Redirect("/404/"));
            }

            //Hiển thị bài chi tiết
            var articleCtrl = new TMV.Data.Entities.ArticleController();

            if (objCategory.IsShowDetail)
            {
                var objArticle = articleCtrl.GetArticleByCategorySlug(categorySlug, _isClearCache);
                if (objArticle == null || objArticle.ArticleId <= 0 || objArticle.CategorySlug != categorySlug)
                {
                    Response.Redirect("/404/");
                }

                var objBanner = new BannerController().GetBannerByCategoryId(objArticle.CategoryId, isMobile, _isClearCache);
                ViewBag.UrlPrice = objBanner != null && objBanner.BannerId > 0 ? objBanner.NavigationUrl : "/bang-gia/";

                ViewBag.ObjCategory = objCategory;
                ViewBag.BreadCrumb  = LoadBreadCrumb(objCategory);
                ViewBag.LineTitle   = objCategory.CategoryName;
                return(PartialView("Detail", objArticle));
            }

            //Hiển thị danh sách bài viết
            if (isMobile)
            {
                _pageSize = 10;
            }
            var articles = objCategory.ParentId <= 0
                ? articleCtrl.ListArticleByGroup(objCategory.CategoryId, objCategory.CategoryId, page, _pageSize, _isClearCache)
                : articleCtrl.ListArticleByCategory(objCategory.CategoryId, page, _pageSize, _isClearCache);

            var total     = articles.Count > 0 ? articles.FirstOrDefault().Total : 0;
            var totalPage = (total % _pageSize == 0) ? (total / _pageSize) : (total / _pageSize + 1);
            var paging    = new TMV.Utilities.Paging()
            {
                Url       = "/" + categorySlug,
                Page      = page,
                TotalPage = totalPage
            };

            ViewBag.Page        = page;
            ViewBag.PageList    = paging.LoadPaging();
            ViewBag.BreadCrumb  = LoadBreadCrumb(objCategory);
            ViewBag.ObjCategory = objCategory;
            ViewBag.LineTitle   = objCategory.CategoryName;

            return(View(articles));
        }
Beispiel #3
0
        public ActionResult Detail(string categorySlug = "", string slug = "")
        {
            var objArticle = new TMV.Data.Entities.ArticleController().GetArticleBySlug(slug, _isClearCache);

            if (objArticle == null || objArticle.CategorySlug != categorySlug)
            {
                Response.Redirect("/404/");
            }

            //var isMobile = MvcApplication.IsMobileMode();
            //var objBanner = new BannerController().GetBannerByCategoryId(objArticle.CategoryId, isMobile, _isClearCache);

            //ViewBag.UrlPrice = objBanner != null && objBanner.BannerId > 0 ? objBanner.NavigationUrl : "/bang-gia/";
            ViewBag.BreadCrumb = LoadBreadCrumbDetail(objArticle);
            ViewBag.LineTitle  = objArticle.CategoryName;

            return(View(objArticle));
        }
Beispiel #4
0
        public ActionResult BoxArticleHome()
        {
            var article = new TMV.Data.Entities.ArticleController().ListArticleByGroup(1, 4, 1, 4, _isClearCache);

            return(PartialView(article));
        }
Beispiel #5
0
        public ActionResult BoxOther(int articleId, int categoryId)
        {
            var articles = new TMV.Data.Entities.ArticleController().ListArticleByOther(articleId, categoryId, 4, 1, _isClearCache);

            return(PartialView(articles));
        }