public void DeleteAuthor(BookAuthor model) { var result = GetAuthorById(model.AuthorId); var deletableBooks = _db.Books.Where(e => e.AuthorId == model.AuthorId); _db.Books.RemoveRange(deletableBooks); _db.BookAuthors.Remove(result); _db.SaveChanges(); }
public void AddAuthor(BookAuthor model) { _db.BookAuthors.Add(model); _db.SaveChanges(); }