コード例 #1
0
        public void AddNewCustomer()
        {
            Console.Clear();
            GreenPlanContent_Repo newContent = new GreenPlanContent_Repo();

            Console.WriteLine("Please enter a hybrid car.");
            newContent.HybridCar = Console.ReadLine();
            Console.WriteLine("Please enter an electric car.");
            newContent.ElectricCar = Console.ReadLine();
            Console.WriteLine("Please enter a type for this car.");
        }
コード例 #2
0
        public void UpdateExistingContent()
        {
            Console.Clear();
            Console.WriteLine("Enter the name of the person's data you'd like to update.");
            string firstName = Console.ReadLine();
            object hybridCar = null;
            GreenPlanContent_Repo oldItem = _repo.FindCarByName(hybridCar);

            if (oldItem == null)
            {
                Console.WriteLine("Person not found, press any key to continue...");
                Console.ReadKey();
                return;
            }
            GreenPlanContent_Repo newItem = new GreenPlanContent_Repo();

            oldItem.HybridCar
            oldItem.ElectricCar;
            Console.WriteLine("Which property would you like to update:\n" +
                              "1. Hybrid Car\n" +
                              "2. Electric Car\n" +
                              "6. Nevermind");
            string selection = Console.ReadLine();

            switch (selection)
            {
            case "1":
                Console.WriteLine("Enter a new title");
                string newFirstName = Console.ReadLine();
                newItem.HybridCar = new hybridCar;
                bool wasSuccessful = _repo.UpdateExistingContent(hybridCar, newCar);
                if (wasSuccessful)
                {
                    Console.WriteLine("Name successfully updated");
                }
                else
                {
                    Console.WriteLine($"Error: Could not update {hybridCar}");
                }
                break;

            default:
                break;
            }
        }
コード例 #3
0
        public void FindCustomerByName()
        {
            Console.Clear();

            Console.WriteLine("Enter the name of the person you'd like to find.");
            string hybridCar = Console.ReadLine();

            GreenPlanContent_Repo content = _repo.FindCarByName(hybridCar);

            if (content != null)
            {
                DisplayContent(content);
            }
            else
            {
                Console.WriteLine("That person doesn't exist");
            }
        }
コード例 #4
0
 private void DisplayContent(GreenPlanContent_Repo content)
 {
     throw new NotImplementedException();
 }