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