public string ShowAllAvailableOffer() { List <Ride> rides = Dbr.GetRides(); if (!rides.Any()) { return("NO RIDES AVAILABLE..."); } StringBuilder offerDetails = new StringBuilder(); offerDetails.Append(string.Format("{0,-10}{1, -11 }{2,-16}{3,-20}", "Index", "Source", "Destination", "SeatAvailable")); //Bug is Here in the format int i = 1; foreach (Ride ride in rides) { offerDetails.Append(string.Format("\n{0,-10}{1, -11 }{2,-16}{3,-20}", i++, ride.Source, ride.Destination, ride.SeatAvailable)); offerDetails.Append("\n[Via Places]\n" + string.Format("{0,-11}{1,-16}{2,-13}{3,-10}", "Source", "Destination", "Distance", "Price")); foreach (Via via in ride.ViaMaps) { offerDetails.Append(string.Format("\n{0,-11}{1,-16}{2,-13}{3,-10}", via.Source, via.Destination, via.Distance, via.Price)); } i++; } return(offerDetails.ToString()); }