public void CreateAuthor(AuthorUpdateViewModel authorView /*, IEnumerable<int> bookId*/) { IEnumerable <AuthorInBook> authorInBook = GetAuthorInBook(authorView /*, bookId*/); _authorInBookRepository.Create(authorInBook); //var authorInBook = new List<AuthorInBook>(); //if (authorView.Books.Count != 0) //{ // foreach (Book b in authorView.Books) // { // authorInBook.Add(new AuthorInBook { Author = authorView.Author, Book = b }); // } //} //if (authorView.Books.Count == 0) //{ // authorInBook.Add(new AuthorInBook { Author = authorView.Author }); //} //_authorInBookRepository.Create(authorInBook); }
public void CreateBook(BookUpdateViewModel bookView, IEnumerable <int> authorId) { IEnumerable <AuthorInBook> authorInBook = GetAuthorInBook(bookView, authorId); _authorInBookRepository.Create(authorInBook); }