public BookDTO(Book book) { BookID = book.BookID; Title = book.Title; DateWrite = book.DateWrite; if (book.author != null) { author = new AuthorDTO(book.author); } }
public static List <AuthorDTO> ToListAuthorDTO(List <Author> authors) { List <AuthorDTO> authorsDTO = new List <AuthorDTO>(); foreach (Author author in authors) { AuthorDTO authorDTO = new AuthorDTO(author); authorDTO.AddBooksAuthor(author); authorsDTO.Add(authorDTO); } return(authorsDTO); }