Exemple #1
0
 public void Update(PieceOfNews pieceOfNews)
 {
     using (var context = new ApplicationDbContext())
     {
         context.Entry(pieceOfNews).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemple #2
0
 public void Add(PieceOfNews pieceOfNews)
 {
     using (var context = new ApplicationDbContext())
     {
         context.News.Add(pieceOfNews);
         context.SaveChanges();
     }
 }