예제 #1
0
        public ActionResult Author(long id)
        {
            TagsBusiness tagsBusiness = new TagsBusiness();
            NewsBusiness newsBusiness = new Business.ClassBusiness.NewsBusiness();

            Tag t = tagsBusiness.GetById(id);

            ViewBag.Tag = t;
            if (t != null)
            {
                if (!string.IsNullOrEmpty(t.SeoTitle))
                {
                    ViewData["Title"] = t.SeoTitle;
                }
                else
                {
                    ViewData["Title"] = t.TagName;
                }
                ViewBag.Description      = t.SeoDescription;
                ViewBag.Description_     = t.Description;
                ViewBag.Keywords         = t.SeoKeyword;
                ViewBag.ShareTitle       = t.ShareTitle;
                ViewBag.ShareKeyword     = t.ShareKeyword;
                ViewBag.ShareDescription = t.ShareDescription;
                ViewBag.published_time   = t.DateCreate;
                ViewBag.updated_time     = t.ModifyDate;
                ViewBag.image            = t.ImageSource;

                ViewData["TagName"] = t.TagName;

                int page = 1;

                if (Request.QueryString["page"] != null)
                {
                    page = int.Parse(Request.QueryString["page"]);
                }
                //  List<News> listNews = new List<News>();
                List <News> listNews = newsBusiness.GetByTagAuthor(t.Id.ToString(), page, Page_Size);

                int count = newsBusiness.CountByTag(t.Id.ToString());

                ////Khởi tạo link tag

                string srtUrl = string.Format("/{0}", t.TagUrl);

                Paging(count, Page_Block, Page_Size, page, page, srtUrl);

                return(View(listNews));
            }
            else
            {
            }
            return(View());
        }
예제 #2
0
        protected string InitTags(string tags)
        {
            string html = string.Empty;

            if (!string.IsNullOrEmpty(tags))
            {
                string[] arraystrTags = tags.Split(';');

                long[] arrayTags = new long[arraystrTags.Count()];
                int    i         = 0;
                foreach (string s in arraystrTags)
                {
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            arrayTags[i] = long.Parse(s);
                            i++;
                        }
                        catch { }
                    }
                }
                TagsBusiness tagsBusiness = new TagsBusiness();
                var          temp         = tagsBusiness.GetByArrayId(arrayTags);
                foreach (Tag t in temp)
                {
                    html += "<li><a href=\"" + Models.Common.Util.ReturnLinkFull(t.TagUrl) + "\">" + t.TagName + "</a></li> ";
                }

                if (!string.IsNullOrEmpty(html))
                {
                    html = html.Substring(0, html.Length - 2);
                }
            }
            return(html);
        }