static void RemoveVehicle() // ta bort fordon { bool vaild = false; int freeParking = 0; Console.WriteLine("Current Parked Vehicle"); ParkingLotOverviewOutPut(); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Licenseplate\t\tVehicle\t\tChecked In"); //översikt för att underlätta för användaren Console.ForegroundColor = ConsoleColor.White; List <Vehicle> currentParkList = databaseSQL.CurrentParkedVehicles(); foreach (var parkedVehicles in currentParkList) { Console.WriteLine("{0}\t\t\t{1}\t\t{2}", parkedVehicles.LicensePlate, parkedVehicles.Description, parkedVehicles.CheckIn); } Console.WriteLine(""); Console.Write("Enter a LicensePlate : "); string license = Console.ReadLine().ToUpper(); Vehicle vehicle = databaseSQL.GetRemoveVehicleData(license); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Parkinglot ID\tLicenseplate\t\tVehicle\t\tChecked-In"); Console.ForegroundColor = ConsoleColor.White; Vehicle vehicle2 = databaseSQL.FindVehicle(license); Console.WriteLine($"{vehicle2.ParkID}\t\t{vehicle2.LicensePlate}\t\t\t{vehicle2.Description}\t\t{vehicle2.CheckIn}"); do { Console.WriteLine("\nAre You Sure That You Want To Check Out This Vehicle? (Yes/No): "); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Note! if there is no vehicle data written, the vehicle is not found! Enter (No) and try again."); Console.ForegroundColor = ConsoleColor.White; Console.Write("Enter: "); string input = Console.ReadLine().ToUpper(); if (input == "YES") { vaild = true; } else if (input == "NO") { Console.Clear(); Menu(); } } while (!vaild); do { vaild = false; Console.WriteLine("IS IT FOR FREEE !?!?!??! (Yes/No)"); string input = Console.ReadLine().ToUpper(); if (input == "YES") { freeParking = 1; vaild = true; } else if (input == "NO") { freeParking = 0; vaild = true; } } while (!vaild); Console.WriteLine("\n\n"); Console.ForegroundColor = ConsoleColor.DarkCyan; databaseSQL.CheckOutGetPrice(vehicle.LicensePlate, freeParking, vehicle.VehicleTypeId); databaseSQL.UpdateParkingLotAfterDeletion(vehicle.VehicleTypeId, vehicle.ExtraValue); Vehicle vehicledata = databaseSQL.GetFullDataOfVehicleBeforeCheckout(license); if (vehicledata == null) { Console.WriteLine("cannot remove dosent exit"); Console.Write("\n\nPress Any key....."); Console.ReadKey(); Console.Clear(); } else { Console.WriteLine($"\tParking Space: {vehicledata.ParkID}\tLicenseplate: {vehicledata.LicensePlate}\tVehicle Type: {vehicledata.Description}"); Console.WriteLine($"Checked IN: {vehicledata.CheckIn}\t\tChecked Out: {vehicledata.CheckOut}\tPrice: {vehicledata.Price}"); string result = databaseSQL.DeleteVehicleAfterCheckOut(vehicle.LicensePlate); if (result == null) { Console.WriteLine("Vechile has not removed"); } else { Console.WriteLine(result); } Console.ForegroundColor = ConsoleColor.White; Console.Write("\n\nPress Any key....."); Console.ReadKey(); Console.Clear(); } }