public void editTrip() { if (trip_Models.Count == 0) { Console.WriteLine("You have no trips to edit"); } else { Console.WriteLine("Enter trip id you want to edit"); int tripId = Convert.ToInt32(Console.ReadLine()); Trip_Model editTrip = trip_Models.Find(trip => tripId == trip.id); Console.WriteLine("Enter passenger name "); String passengerName = Console.ReadLine(); editTrip.passengerName = passengerName; Console.WriteLine("Enter price "); String price = Console.ReadLine(); editTrip.price = price; Console.WriteLine("Enter country "); String country = Console.ReadLine(); editTrip.country = country; Console.WriteLine("\nYour trips after edit"); for (int i = 0; i < trips; i++) { Console.WriteLine("Trip id : " + trip_Models[i].id + "\n" + "Passenger name : " + trip_Models[i].passengerName + "\n" + "Country : " + trip_Models[i].country + "\n" + "Price : " + trip_Models[i].price + "\n"); } } }
public void deleteTrip() { if (trip_Models.Count == 0) { Console.WriteLine("You have no trips to delete"); } else { Console.WriteLine("You have : " + trip_Models.Count + " trips"); Console.WriteLine("Enter trip id you want to delete"); int tripId = Convert.ToInt32(Console.ReadLine()); Trip_Model deletedTrip = trip_Models.Find(trip => tripId == trip.id); bool isDeleted = trip_Models.Remove(deletedTrip); if (isDeleted) { Console.WriteLine("Now you have : " + trip_Models.Count + " trips"); } else { Console.WriteLine("Please check trip id"); } } }