コード例 #1
0
ファイル: NewsDao.cs プロジェクト: PavelPal/Association
 public void Update(PieceOfNews pieceOfNews)
 {
     using (var context = new ApplicationDbContext())
     {
         context.Entry(pieceOfNews).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #2
0
ファイル: NewsDao.cs プロジェクト: PavelPal/Association
 public void Add(PieceOfNews pieceOfNews)
 {
     using (var context = new ApplicationDbContext())
     {
         context.News.Add(pieceOfNews);
         context.SaveChanges();
     }
 }