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