//InsertIntoDB(Ibook,IAuthor,ICSV) public void InsertIntoDB(List <AuthorBook> items, IBookDAL bookDAL, IAuthorDAL authorDAL) { var book = new Book(); var author = new Author(); foreach (var item in items) { author.authorName = item.authorName; book.bookName = item.bookName; if (authorDAL.SearchAuthorByName(author.authorName) == null) { ; } { authorDAL.InsertAuthor(author); } book.authorId = authorDAL.SearchAuthorByName(author.authorName).id; bookDAL.InsertBook(book); } }
public AuthorDALFactory() { Data = new AuthorDAL(new LibrayContextFactory().Create()); }
public AuthorDALFactory(ILibrayContext context) { Data = new AuthorDAL(context); }
public AuthorService(IAuthorDAL authorDAL) { _authorDAL = authorDAL; }