コード例 #1
0
        public static List <Restaurant> DisplayAllRestaurantDesc
            (List <Restaurant> lsRestaurants)
        {
            List <Restaurant> lsRest = new List <Restaurant>();

            foreach (var item in RRBusinessLogic.GetAllRestaurants())
            {
                lsRest.Add((Restaurant)item);
            }
            lsRest = (from restaurant in lsRest
                      orderby restaurant.Name descending
                      select restaurant).ToList();

            return(lsRest);
        }
コード例 #2
0
        public static List <Restaurant> DisplayTopThreeRestaurants()
        {
            int topThree             = 3;
            List <Restaurant> lsRest = new List <Restaurant>();

            // Converting restaurant list from data to business
            foreach (var item in RRBusinessLogic.GetAllRestaurants())
            {
                lsRest.Add((Restaurant)item);
            }
            lsRest = (from restaurant in lsRest
                      orderby restaurant.AvgRating descending
                      select restaurant).Take(topThree).ToList();

            return(lsRest);
        }