示例#1
0
        public List <T> DisplayRestaurants <T>(List <T> restaurant)
        {
            RestaurantsDbEntities dbutilities = new RestaurantsDbEntities();
            var query = from r in dbutilities.Restaurants
                        select r;

            foreach (var item in query)
            {
                Console.WriteLine(item);
            }
            return(restaurant);
        }
示例#2
0
        public void DisplayTop3()
        {
            RestaurantsDbEntities dbutilities = new RestaurantsDbEntities();
            var query = (from r in dbutilities.Restaurants
                         orderby r.AvgRating descending
                         select r).Take(3);

            Console.WriteLine("Here are the top 3 Restaurants:");
            foreach (var item in query)
            {
                Console.WriteLine(item);
            }
        }
示例#3
0
        public void DisplayReviews <T>(List <T> review)
        {
            Console.WriteLine("Which reviews would you like to see: ");
            var desired = Console.ReadLine();
            RestaurantsDbEntities dbutilities = new RestaurantsDbEntities();
            var query = from r in dbutilities.Reviews
                        where r.Restaurant.Equals(desired)
                        select r;

            foreach (var item in query)
            {
                Console.WriteLine(item);
            }
        }