Beispiel #1
0
        public Boolean addNews(SiteNewsModel siteNewsModel)
        {
            geekinsidekmsEntities context = new geekinsidekmsEntities();

            DAL.SiteNews siteNews = new DAL.SiteNews();
            siteNews.Title = siteNewsModel.Title;
            siteNews.NewsContent = siteNewsModel.NewsContent;
            siteNews.PubTime = siteNewsModel.PubTime;
            siteNews.IsOnTop = siteNewsModel.IsOnTop;
            context.AddToSiteNews(siteNews);
            context.SaveChanges();
            return true;
        }
Beispiel #2
0
 //更新公告内容
 public Boolean updateNews(SiteNewsModel siteNewsModel)
 {
     return siteNewsDAL.updateNews(siteNewsModel);
 }
Beispiel #3
0
 //增加公告
 public Boolean add(SiteNewsModel siteNewsModel)
 {
     return siteNewsDAL.addNews(siteNewsModel);
 }
Beispiel #4
0
        public Boolean updateNews(SiteNewsModel siteNewsModel)
        {
            geekinsidekmsEntities context = new geekinsidekmsEntities();

            DAL.SiteNews dbNews = (from news in context.SiteNews
                                   where news.Id.Equals(siteNewsModel.Id)
                                   select news).FirstOrDefault();
            dbNews.Title = siteNewsModel.Title;
            dbNews.NewsContent = siteNewsModel.NewsContent;
            dbNews.PubTime = siteNewsModel.PubTime;
            dbNews.IsOnTop = siteNewsModel.IsOnTop;
            context.SaveChanges();
            return true;
        }