Beispiel #1
0
        internal static void AddReview(RestaurantModels.Restaurant restaurant)
        {
            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("Type 'add' to add review to restaurant");
                Console.WriteLine("Type 'get' to see all reviews for restaurant");
                Console.WriteLine("Type 'avg' to get average review");
                Console.WriteLine("Type 'info' for restaurant info");
                Console.WriteLine("Type 'back' to go back");
                Console.WriteLine("Type 'exit' to exit");
                string option = Console.ReadLine();
                switch (option)
                {
                case "add":
                    RestaurantAccessLibrary.AddNewReview(RestaurantModels.Restaurant.CreateReview(restaurant));
                    break;

                case "back":
                    Find();
                    break;

                case "get":
                    foreach (var item in RestaurantAccessLibrary.GetRestaurantByID(restaurant.ID).Reviews)
                    {
                        Console.WriteLine(item.GetFormattedReview());
                    }
                    break;

                case "avg":
                    Console.WriteLine();
                    Console.WriteLine("Average Review Rating: " + restaurant.GetAvgReview());
                    break;

                case "info":
                    Console.WriteLine();
                    restaurant.PrintInfo();
                    break;

                case "exit":
                    Exit();
                    break;

                default:
                    Console.WriteLine("Enter Valid Option");
                    log.Error($"{option} is not a valid option");
                    break;
                }
            }
        }