public void UpdateNews(News news) { using (var context = new GiaikhatNgocMaiEntities()) { context.Entry(news).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public int CreateNews(News news) { using (var context = new GiaikhatNgocMaiEntities()) { context.News.Add(news); context.SaveChanges(); return news.Id; } }