public void Call() { var vehicleModels = _vehicleModelRepository.GetAll(); PrintHelpers.PrintVehicleModels(vehicleModels); Console.WriteLine("Type in vehicle model Id or exit"); var isRead = ReadHelpers.TryReadNumber(out var vehicleModelId); if (!isRead) { return; } var result = _vehicleModelRepository.Delete(vehicleModelId); if (result == ResponseResultType.NotFound) { Console.WriteLine("Vehicle model not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Vehicle model deleted successfully"); } Console.ReadLine(); Console.Clear(); }
public void Call() { var vehicleModels = _vehicleModelRepository.GetAll(); PrintHelpers.PrintVehicleModels(vehicleModels); Console.WriteLine("Vehicle model id or exit"); var isRead = ReadHelpers.TryReadNumber(out var vehicleModelId); if (!isRead) { return; } Console.WriteLine("Enter kilometers"); var isNumber = int.TryParse(Console.ReadLine(), out var kilometers); if (!isNumber) { Console.WriteLine("Kilometers not a number"); Console.ReadLine(); return; } var result = _vehicleRepository.Add(kilometers, vehicleModelId); if (result == ResponseResultType.NotFound) { Console.WriteLine("Vehicle model not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Successfully added vehicle"); } Console.ReadLine(); Console.Clear(); }