Example #1
0
        public List <NewsModel> GetAllNews(int siteGuid)
        {
            SiteNewsCollection   siteNewsCollection = new SiteNewsCollection();
            IPredicateExpression filter             = new PredicateExpression();

            filter.Add(SiteNewsFields.SiteGuid == siteGuid);

            if (siteNewsCollection.GetMulti(filter))
            {
                return(siteNewsCollection.Select(m => ToNewsModel(m)).ToList());
            }
            return(null);
        }
Example #2
0
        private SiteNewsEntity GetSiteNewsEntity(int newsGuid)
        {
            SiteNewsCollection   siteNewsCollection = new SiteNewsCollection();
            IPredicateExpression filter             = new PredicateExpression();

            filter.Add(SiteNewsFields.NewsGuid == newsGuid);
            siteNewsCollection.GetMulti(filter);

            if (siteNewsCollection.Count == 0)
            {
                return(null);
            }
            else
            {
                return(siteNewsCollection[0]);
            }
        }