コード例 #1
0
        public IQueryable <RestaurantInformation> GetRestaurantsBasedOnOrderRating()
        {
            try
            {
                BusinessEntities.LocationDetails     locationDetails = new BusinessEntities.LocationDetails();
                List <RestaurantInformation>         restaurant_Info = new List <RestaurantInformation>();
                IQueryable <RestaurantSearchDetails> searched_Restaurant;
                //DataLayer.DataEntity.AddtitionalFeatureForSearch searchCritera = new DataLayer.DataEntity.AddtitionalFeatureForSearch
                //{
                //    rating = (additionalFeatureForSearch.rating != null && additionalFeatureForSearch.rating > 0) ? additionalFeatureForSearch.rating : 0
                //};

                //DataLayer.DataEntity.LocationDetails location_Details = new DataLayer.DataEntity.LocationDetails
                //{
                //    //distance = locationDetails.distance,
                //    //restaurant_Name = locationDetails.restaurant_Name,
                //    xaxis = searchDetails.location.xaxis,
                //    yaxis = searchDetails.location.yaxis
                //};
                // DataLayer.DataEntity.SearchForRestautrant searchCritera = new DataLayer.DataEntity.SearchForRestautrant
                //{
                //    location = location_Details

                //};
                searched_Restaurant = search_Repository.GetRestaurantsBasedOnRatingOrder();
                if (searched_Restaurant != null)
                {
                    foreach (var restaurants in searched_Restaurant)
                    {
                        RestaurantInformation restaurant_Details = new RestaurantInformation
                        {
                            restaurant_ID        = restaurants.restauran_ID,
                            restaurant_Name      = restaurants.restaurant_Name,
                            restaurant_Address   = restaurants.restaurant_Address,
                            restaurant_ContactNo = restaurants.restaurant_PhoneNumber,
                            closing_Time         = restaurants.closing_Time,
                            opening_Time         = restaurants.opening_Time,
                            website = restaurants.restraurant_Website,
                            xaxis   = restaurants.xaxis,
                            yaxis   = restaurants.yaxis
                        };
                        restaurant_Info.Add(restaurant_Details);
                    }
                }


                return(restaurant_Info.AsQueryable());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
 public IQueryable <RestaurantInformation> SearchForRestaurant(SearchForRestaurant searchDetails)
 {
     try
     {
         BusinessEntities.AdditionalFeatureForSearch additionalFeatureForSearch = new BusinessEntities.AdditionalFeatureForSearch();
         BusinessEntities.LocationDetails            locationDetails            = new BusinessEntities.LocationDetails();
         List <RestaurantInformation>                     restaurant_Info       = new List <RestaurantInformation>();
         IQueryable <RestaurantSearchDetails>             searched_Restaurant;
         DataLayer.DataEntity.AddtitionalFeatureForSearch addSearchCritera = new DataLayer.DataEntity.AddtitionalFeatureForSearch
         {
             cuisine = (string.IsNullOrEmpty(searchDetails.search.cuisine) ? "" : searchDetails.search.cuisine),
             Menu    = (string.IsNullOrEmpty(searchDetails.search.Menu) ? "" : searchDetails.search.Menu),
             rating  = (searchDetails.search.rating != null && searchDetails.search.rating > 0) ? searchDetails.search.rating : 0
         };
         DataLayer.DataEntity.LocationDetails location_Details = new DataLayer.DataEntity.LocationDetails
         {
             distance        = searchDetails.location.distance,
             restaurant_Name = searchDetails.location.restaurant_Name,
             xaxis           = searchDetails.location.xaxis,
             yaxis           = searchDetails.location.yaxis
         };
         DataLayer.DataEntity.SearchForRestautrant searchCritera = new DataLayer.DataEntity.SearchForRestautrant
         {
             search   = addSearchCritera,
             location = location_Details
         };
         searched_Restaurant = search_Repository.SearchForRestaurant(searchCritera);
         if (searched_Restaurant != null)
         {
             foreach (var restaurants in searched_Restaurant)
             {
                 RestaurantInformation restaurant_Details = new RestaurantInformation
                 {
                     restaurant_ID        = restaurants.restauran_ID,
                     restaurant_Name      = restaurants.restaurant_Name,
                     restaurant_Address   = restaurants.restaurant_Address,
                     restaurant_ContactNo = restaurants.restaurant_PhoneNumber,
                     closing_Time         = restaurants.closing_Time,
                     opening_Time         = restaurants.opening_Time,
                     website = restaurants.restraurant_Website,
                     xaxis   = restaurants.xaxis,
                     yaxis   = restaurants.yaxis
                 };
                 restaurant_Info.Add(restaurant_Details);
             }
         }
         return(restaurant_Info.AsQueryable());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
        public IQueryable <RestaurantInformation> SearchRestaurantByLocation(BusinessEntities.LocationDetails locationDetails)
        {
            try
            {
                List <RestaurantInformation>         restaurant_Info = new List <RestaurantInformation>();
                IQueryable <RestaurantSearchDetails> searched_Restaurant;
                DataLayer.DataEntity.LocationDetails location_Details = new DataLayer.DataEntity.LocationDetails
                {
                    distance        = locationDetails.distance,
                    restaurant_Name = locationDetails.restaurant_Name,
                    xaxis           = locationDetails.xaxis,
                    yaxis           = locationDetails.yaxis
                };

                searched_Restaurant = search_Repository.GetRestaurantsBasedOnLocation(location_Details);
                foreach (var restaurants in searched_Restaurant)
                {
                    RestaurantInformation restaurant_Details = new RestaurantInformation
                    {
                        restaurant_ID        = restaurants.restauran_ID,
                        restaurant_Name      = restaurants.restaurant_Name,
                        restaurant_Address   = restaurants.restaurant_Address,
                        restaurant_ContactNo = restaurants.restaurant_PhoneNumber,
                        closing_Time         = restaurants.closing_Time,
                        opening_Time         = restaurants.opening_Time,
                        website = restaurants.restraurant_Website,
                        xaxis   = restaurants.xaxis,
                        yaxis   = restaurants.yaxis
                    };
                    restaurant_Info.Add(restaurant_Details);
                }
                return(restaurant_Info.AsQueryable());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }