public static void AddPublisher(Publisher publisher) { using (LibraryDataContext ctx = new LibraryDataContext()) { ctx.Publishers.Add(publisher); ctx.SaveChanges(); } }
public static void UpdatePublisher(Publisher persistentPublisher) { using (LibraryDataContext ctx = new LibraryDataContext()) { ctx.Publishers.Attach(persistentPublisher); ctx.Entry(persistentPublisher).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }