コード例 #1
0
ファイル: News.cs プロジェクト: ThePublicTheater/NYSF
 public NewsViewModel(News Article, int CommentPage)
 {
     _news = Article;
     commPage = CommentPage;
     NewsDBcontext NewsDB = new NewsDBcontext();
     _comments = NewsDB.MasterCommentsListing.Where(s => s.NewsId == _news.JoomlaID).ToList();
 }
コード例 #2
0
ファイル: News.cs プロジェクト: ThePublicTheater/NYSF
        public NewsListViewModel(int Pagenumber, int NumberArticlesPerPage, DateTime From, DateTime To, string SearchString)
        {
            Key = SearchString;
            From_Date = From;
            To_Date = To;
            Page = Pagenumber;
            NumPerPage = NumberArticlesPerPage;

            NewsDBcontext DB = new NewsDBcontext();

            List<News> temp = new List<News>();
            temp.AddRange(DB.MasterNewsListing.Where(s => (s.Publish >= From_Date && s.Publish <= To_Date)).ToList());
            if (Key != "")
            {
                string[] temparr = Key.Split(' ');
                var res = temp.Where(s => temparr.Any(a => s.Title.Contains(a) || s.Title_alias.Contains(a) || s.IntroText.Contains(a) || s.FullText.Contains(a)));
                if (res != null && res.Count() > 0)
                {
                    temp = res.ToList();
                }
            }
            _articles = temp;
            DB.Dispose();
        }