//private static Author GetAuthor(Author author) //{ // using (var context = new BookDBDataContext()) // { // return context.Authors.FirstOrDefault(a => a.FirstName.Equals(author.FirstName) && a.LastName.Equals(author.LastName)); // } //} private static void AddGenre(string genre) { using (var context = new BookDBDataContext()) { if (context.Genres.FirstOrDefault(g => g.Name.Equals(genre)) == null) { Genre gen = new Genre() { Name = genre }; context.Genres.InsertOnSubmit(gen); context.SubmitChanges(); } } }
partial void UpdateGenre(Genre instance);
partial void DeleteGenre(Genre instance);
partial void InsertGenre(Genre instance);