public Book Add(Book book) { var addedBook = context.Add(book); context.SaveChanges(); return(addedBook.Entity); }
public Author AuthorWithName(string name) { var author = context.Authors.Find(name); if (author == null) { var newAuthor = new Author(name); context.Add(newAuthor); context.SaveChanges(); return(newAuthor); } else { return(author); } }