Exemplo n.º 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;
                }
            }
        }
 internal static void Select(string selected)
 {
     Console.WriteLine();
     Console.WriteLine("Selected: " + selected);
     RestaurantModels.Restaurant restaurant = RestaurantAccessLibrary.GetRestaurantByName(selected);
     if (restaurant == null)
     {
         Console.WriteLine();
         Console.WriteLine("Please enter correct restaurant name");
         Find();
     }
     else
     {
         AddReview(restaurant);
     }
 }
Exemplo n.º 3
0
 internal static void Select(string selected)
 {
     Console.WriteLine("Selected: " + selected);
     try
     {
         RestaurantModels.Restaurant restaurant = RestaurantAccessLibrary.GetRestaurantByName(selected);
         AddReview(restaurant);
     }
     catch (Exception e)
     {
         log.Error($"{selected} cannot be converted or does not exist");
         Console.WriteLine();
         Console.WriteLine("Please enter correct restaurant name");
         Find();
     }
 }