/* * converts a list of books to a list of book descriptions */ public List <BookDesc> ConvertBookListToDesc(List <Book> books) { AuthorManager authorManager = new AuthorManager(); List <BookDesc> bookDescs = new List <BookDesc>(); foreach (Book book in books) { Author author = authorManager.GetAuthorByID(book.AuthorID); BookDesc bookDesc = new BookDesc(); bookDesc.Title = book.Title; bookDesc.ISBN = book.ISBN; bookDesc.AuthorName = author.LastName + ", " + author.FirstName; bookDesc.AuthorID = book.AuthorID; bookDesc.Publisher = book.Publisher; bookDesc.Pages = book.Pages; bookDesc.Copies = book.Copies; bookDesc.Active = book.Active; bookDescs.Add(bookDesc); } return(bookDescs); }
public BookDesc ConvertBookToDesc(Book book) { AuthorManager authorManager = new AuthorManager(); Author author = authorManager.GetAuthorByID(book.AuthorID); BookDesc bookDesc = new BookDesc(); bookDesc.Title = book.Title; bookDesc.ISBN = book.ISBN; bookDesc.AuthorName = author.LastName + ", " + author.FirstName; bookDesc.AuthorID = book.AuthorID; bookDesc.Publisher = book.Publisher; bookDesc.Pages = book.Pages; bookDesc.Copies = book.Copies; bookDesc.Active = book.Active; return(bookDesc); }