Exemple #1
0
        public void createBook(string title, string ISBN, string pages, string publicationInfo, string signId, List <string> authors)
        {
            BookRepository bookManagerObj = new BookRepository();
            Book           newBook        = new Book();

            newBook.Title           = title;
            newBook.ISBN            = ISBN;
            newBook.pages           = Convert.ToInt16(pages);
            newBook.publicationinfo = publicationInfo;
            newBook.SignId          = Convert.ToInt32(signId);
            AuthorRepository authorGrabber = new AuthorRepository();
            List <AUTHOR>    authorList    = new List <AUTHOR>();

            foreach (var author in authors)
            {
                var grabbedAuthor = authorGrabber.ReadUninclude(Convert.ToInt32(author));
                authorList.Add(grabbedAuthor);
            }
            newBook.Author = Mapper.Map <List <Author> >(authorList);

            bookManagerObj.CreateNew(Mapper.Map <BOOK>(newBook));
        }