コード例 #1
0
ファイル: UserUI.cs プロジェクト: GoranTurundzov/C_sharp
        public static void SupplyerPannel(Supplyer user)
        {
            while (true)
            {
                Console.WriteLine("Select: \n 1. Set Car Price \n 2. Get a new car for the shop \n 0. Exit");
                int id = 0;
                switch (Console.ReadLine())
                {
                case "1":
                    Console.Clear();
                    Console.WriteLine(ShopDB.GetCarsForSupplyer());
                    while (true)
                    {
                        Console.WriteLine("Select a car by ID to set a new price");
                        if (!int.TryParse(Console.ReadLine(), out id))
                        {
                            Console.WriteLine("Invalid Selection");
                            continue;
                        }
                        Vehicle car = ShopDB.Vehicles.FirstOrDefault(x => x.Id == id);
                        if (car == null)
                        {
                            Console.WriteLine("No car with that ID exists");
                            continue;
                        }
                        SetCarPrice(user, car);
                        break;
                    }
                    continue;

                case "2":
                    AquireNewCar();
                    continue;

                case "0":
                    Helper.SlowPrint("Exiting menu...");
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    continue;
                }
                break;
            }
        }