public void Call() { var vehicleBrands = _vehicleBrandRepository.GetAll(); PrintHelpers.PrintVehicleBrands(vehicleBrands); Console.WriteLine("Type in vehicle brand Id or exit"); var isRead = ReadHelpers.TryReadNumber(out var vehicleBrandId); if (!isRead) { return; } var result = _vehicleBrandRepository.Delete(vehicleBrandId); if (result == ResponseResultType.NotFound) { Console.WriteLine("Vehicle brand not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Vehicle brand deleted successfully"); } Console.ReadLine(); Console.Clear(); }
public void Call() { Console.WriteLine("Enter vehicle brand:"); var vehicleBrands = _vehicleBrandRepository.GetAll(); PrintHelpers.PrintVehicleBrands(vehicleBrands); Console.WriteLine("Enter vehicle brand id:"); var isRead = ReadHelpers.TryReadNumber(out var vehicleBrandId); if (!isRead) { return; } Console.WriteLine("Enter one of vehicle types"); var vehicleTypes = Enum.GetValues <VehicleType>(); foreach (var vehicleType in vehicleTypes) { Console.WriteLine(vehicleType); } var isValidVehicleType = Enum.TryParse <VehicleType>(Console.ReadLine(), true, out var vehicleModelType); if (!isValidVehicleType) { Console.WriteLine("Invalid vehicle type"); return; } Console.WriteLine("Enter vehicle model"); var model = Console.ReadLine(); var result = _vehicleModelRepository.Add(vehicleModelType, model, vehicleBrandId); if (result == ResponseResultType.AlreadyExists) { Console.WriteLine("Vehicle model already exists"); } if (result == ResponseResultType.NotFound) { Console.WriteLine("Vehicle brand not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Vehicle model successfully saved"); } Console.ReadLine(); Console.Clear(); }