//public BookDto(string bookName, Genre type, IEnumerable<AuthorDto> authors):base() //{ // Name=bookName; // Authors=new List<AuthorDto>(authors); //} //public BookDto(string bookName, Genre type, AuthorDto author) // : this(bookName, type, new AuthorDto[] {author}) //{} public override string ToString() { StringBuilder sb = new StringBuilder($"[{Id}]:\"{Name}\""); if (BookAuthors != null && BookAuthors.Count() > 0) { sb.Append(": {"); foreach (var bookAuthor in BookAuthors) { sb.AppendFormat("{0},", bookAuthor.Author != null ? bookAuthor.Author.Name : "not-loaded"); } sb.Remove(sb.Length - 1, 1); sb.Append("}, "); } else { sb.Append(": {unkonwn author(s)}, "); } if (BookGenres != null && BookGenres.Count() > 0) { sb.Append(": {"); foreach (var bookGenre in BookGenres) { sb.AppendFormat("{0},", bookGenre.Genre != null ? bookGenre.Genre.Name : "not-loaded"); } sb.Remove(sb.Length - 1, 1); sb.Append("}, "); } else { sb.Append(": {unkonwn author(s)}, "); } sb.Append($"Raiting:{Raiting ?? 0}, "); //sb.Append($"Genre:{Genre}"); return(sb.ToString()); }
public override string ToString() { return($"{Title} {Isbn} mit {BookAuthors.Count()} Autoren"); }