Beispiel #1
0
 /// <summary>
 /// 添加新公告
 /// </summary>
 public static bool AddNews(News model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.News.Add(model);
             db.SaveChanges();
         }
         return true;
     }
     catch (Exception ee)
     {
         throw ee.InnerException;
         //return false;
     }
 }
Beispiel #2
0
 /// <summary>
 /// 修改公告
 /// </summary>
 public static bool ModifyNews(int news_id, News model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.News.Find(news_id);
             temp.admin_id = model.admin_id;
             temp.new_date = model.new_date;
             temp.news_content = model.news_content;
             temp.news_title = model.news_title;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }