protected override void ExecuteCore(Guid playerId) { var player = PlayerService.GetPlayer(playerId); var balance = _ledgerService.GetBalance(playerId); var creditPlural = balance != 1 ? "s" : string.Empty; Console.WriteLine($"{player.Name} currently has {balance} credit{creditPlural}."); Console.WriteLine("Detailed credit listing:"); var textyTable = new Dictionary <string, List <string> >(); textyTable["Type"] = new List <string>(); textyTable["Amount"] = new List <string>(); textyTable["Time"] = new List <string>(); textyTable["Round"] = new List <string>(); var history = _ledgerService.GetPlayerHistory(playerId); foreach (var item in history.OrderBy(a => a.TransactionTime)) { textyTable["Type"].Add(item.Type.ToString()); textyTable["Amount"].Add(item.Amount.ToString()); textyTable["Time"].Add(item.TransactionTime.ToString()); int?roundNumber = null; if (item.RoundId.HasValue) { roundNumber = _roundService.GetRound(item.RoundId.Value).RoundNumber; } textyTable["Round"].Add(roundNumber?.ToString()); } var output = new StringBuilder(); AppendHeader(textyTable, "Type", output); AppendHeader(textyTable, "Amount", output); AppendHeader(textyTable, "Time", output); AppendHeader(textyTable, "Round", output); output.AppendLine(); output.Append('-', output.Length - 1).AppendLine(); for (var i = 0; i < history.Count; ++i) { AppendRow(textyTable, new [] { "Type", "Amount", "Time", "Round" }, output, i); } Console.WriteLine(output.ToString()); }