private static void AddAuthorsToBook(int bookID, List <Author> bookAuthors) { using (BookDBDataContext context = new BookDBDataContext()) { foreach (var author in bookAuthors) { var bookAuthor = new BookAuthor() { BookID = bookID, AuthorID = author.ID }; context.BookAuthors.InsertOnSubmit(bookAuthor); } context.SubmitChanges(); } }
private static void AddAuthorsToBook(int bookID, List<Author> bookAuthors) { using (BookDBDataContext context = new BookDBDataContext()) { foreach (var author in bookAuthors) { var bookAuthor = new BookAuthor() { BookID = bookID, AuthorID = author.ID }; context.BookAuthors.InsertOnSubmit(bookAuthor); } context.SubmitChanges(); } }
partial void DeleteBookAuthor(BookAuthor instance);
partial void UpdateBookAuthor(BookAuthor instance);
partial void InsertBookAuthor(BookAuthor instance);
private void detach_BookAuthors(BookAuthor entity) { this.SendPropertyChanging(); entity.Author = null; }
private void attach_BookAuthors(BookAuthor entity) { this.SendPropertyChanging(); entity.Author = this; }