Ejemplo n.º 1
0
        public PartialViewResult Index(string slug, string url, string tag = "", int pageId = 0, int ctrId = 0, int cateId = 0, int page = 1)
        {
            var       total   = 0;
            const int rowPage = 5;
            var       keyword = "";
            var       text    = "";
            var       search  = slug.Contains("search");
            var       isTag   = tag.Contains("tag");

            if (search)
            {
                text    = Request["keyword"];
                keyword = FomatString.Slug(text);
            }
            var pages = string.Format("/{0}-p{1}c{2}p", slug, pageId, cateId);
            var model = new ModelNewsItem
            {
                ListItem = isTag ? _bl.GetNewByTag(slug, cateId, page, rowPage, ref total)
                    : search?_bl.GetNewKeyword(keyword, page, rowPage, ref total) : _bl.GetList(cateId, page, rowPage, ref total),
                               PageHtml = isTag ? Paging.GetPage("/tag/" + slug + "/", 2, page, rowPage, total) :
                                          !search?Paging.GetPage(pages, 2, page, rowPage, total) :
                                              Paging.GetPage(pages, 2, page, rowPage, total, "keyword", text),
                                              CategoryItem = _productBl.CategoryItem(cateId),
                                              CtrId        = ctrId,
                                              CtrUrl       = url
            };

            return(PartialView(model));
        }