TypeOfBody EnterTypeOfBody() { TypeOfBody type = TypeOfBody.sedan; Console.Clear(); MenuAddTypeOfBody(); switch (EnterNumber(countTypeOBody, () => MenuAddTypeOfBody())) { case 1: type = TypeOfBody.sedan; break; case 2: type = TypeOfBody.coupe; break; case 3: type = TypeOfBody.wagon; break; case 4: type = TypeOfBody.hatchback; break; case 5: type = TypeOfBody.pickup; break; case 6: type = TypeOfBody.cabriolet; break; } return(type); }
public void AddCar() { Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Addition of the car in a motor pool."); Console.ForegroundColor = ConsoleColor.Gray; int id = EnterYearOrId("id"); MarkOfCar mark = EnterMarkCar(); TypeOfBody body = EnterTypeOfBody(); TypeOfFuelCar type = EnterTypeOfFuelCar(); Console.Clear(); int year = EnterYearOrId("year of release"); double volumeOfTheEngine; if (type == TypeOfFuelCar.electricity) { Console.Clear(); volumeOfTheEngine = 0; } else { volumeOfTheEngine = EnterVolumeOfTheEngine(); } Cars.Add(new Car(id, mark, body, type, year, volumeOfTheEngine)); }
public Car(int id, MarkOfCar mark, TypeOfBody typeOfBody, TypeOfFuelCar typeOfFuel, int yearOfRelease, double volumeOfTheEngine) { Id = id; Mark = mark; TypeOfBody = typeOfBody; TypeOfFuel = typeOfFuel; YearOfRelease = yearOfRelease; VolumeOfTheEngine = volumeOfTheEngine; IsServiceability = true; IsHire = false; }