public List <Restaurant> SearchRestaurant(string s) { if (s != null) { return(RestaurantManager.Search(s).OrderByDescending(y => y.premium).ToList()); } else { return(RestaurantManager.GetAll().OrderByDescending(y => y.premium).ToList()); } }
public static void SearchItemsByName(ref RestaurantManager restaurantManager) { Console.WriteLine("Enter the name you are looking for:"); string searchName = Console.ReadLine(); while (string.IsNullOrWhiteSpace(searchName)) { Console.WriteLine("Error! Enter the search correctly!"); searchName = Console.ReadLine(); } foreach (var item in restaurantManager.Search(searchName)) { Console.WriteLine($"Name; {item.Name}\nNo: {item.Name}\nCategory: {item.Category}\nPrice: {item.Price}"); } }