Example #1
0
 public List <News> GetListComments(string key)
 {
     try
     {
         List <News> listresults = new List <News>();
         var         listnewid   = GetDynamicQuery().Select(x => x.NewId).Distinct();
         if (listnewid.Any())
         {
             if (string.IsNullOrEmpty(key))
             {
                 foreach (var l in listnewid)
                 {
                     listresults.Add(new NewsBusiness().GetById(l.Value));
                 }
             }
             else
             {
                 foreach (var l in listnewid)
                 {
                     var item = new NewsBusiness().GetById(l.Value);
                     if (item.Title.Contains(key))
                     {
                         listresults.Add(item);
                     }
                 }
             }
         }
         return(listresults);
     }
     catch
     {
         return(null);
     }
 }
Example #2
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());
        }
Example #3
0
        public JsonResult GetNewHome(long id)
        {
            Business.ClassBusiness.NewsBusiness newsBusiness = new Business.ClassBusiness.NewsBusiness();
            List <Common.News> listNews = newsBusiness.ListByNewsIdNewsGroupActive(id, 2);

            List <ModelNews> ListNew = new List <ModelNews>();

            foreach (var tem in listNews)
            {
                ModelNews dl = new ModelNews();
                dl.Title = tem.Title;
                // dl.CreateDate = tem.CreateDate;
                dl.Summary      = tem.Summary;
                dl.NewsGroupId  = tem.NewsGroupId;
                dl.ModifyDate   = tem.ModifyDate.ToString("dd/M/yyyy");
                dl.Descriptions = tem.Descriptions;
                dl.ImageSource  = tem.ImageSource;
                dl.Id           = tem.Id;
                dl.FriendlyUrl  = tem.FriendlyUrl;
                ListNew.Add(dl);
            }

            return(Json(ListNew, JsonRequestBehavior.AllowGet));
        }