Exemple #1
0
        //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);
            }
        }
Exemple #2
0
 public AuthorDALFactory()
 {
     Data = new AuthorDAL(new LibrayContextFactory().Create());
 }
Exemple #3
0
 public AuthorDALFactory(ILibrayContext context)
 {
     Data = new AuthorDAL(context);
 }
 public AuthorService(IAuthorDAL authorDAL)
 {
     _authorDAL = authorDAL;
 }