public IQueryable <RestaurantInformation> SearchForRestaurants(SearchForRestaurant searchDetails) { try { 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.AddtitionalFeatureForSearch searchForRestaurant = 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.SearchForRestautrant restaurant = new DataLayer.DataEntity.SearchForRestautrant { location = location_Details, search = searchForRestaurant }; List <RestaurantInformation> restaurant_Info = new List <RestaurantInformation>(); IQueryable <RestaurantSearchDetails> searched_Restaurant; searched_Restaurant = search_Repository.SearchForRestaurants(restaurant); //Result 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; } }
public IQueryable <RestaurantInformation> SearchForRestaurant(SearchForRestaurant searchDetails) { try { List <RestaurantInformation> restaurantInformationList = new List <RestaurantInformation>(); DataLayer.DataEntity.LocationDetails locationDetails = new DataLayer.DataEntity.LocationDetails() { restaurant_Name = searchDetails.location.restaurant_Name, distance = searchDetails.location.distance, xaxis = searchDetails.location.xaxis, yaxis = searchDetails.location.yaxis }; DataLayer.DataEntity.AddtitionalFeatureForSearch addtitionalFeatureForSearch = new AddtitionalFeatureForSearch() { cuisine = searchDetails.search.cuisine, Menu = searchDetails.search.Menu, rating = searchDetails.search.rating }; DataLayer.DataEntity.SearchForRestautrant searchForRestautrant = new SearchForRestautrant() { location = locationDetails, search = addtitionalFeatureForSearch }; IQueryable <RestaurantSearchDetails> searchedRestaurants = search_Repository.SearchForRestaurant(searchForRestautrant); if (searchedRestaurants != null) { foreach (var restaurant in searchedRestaurants) { RestaurantInformation restaurantDetails = new RestaurantInformation { restaurant_ID = restaurant.restauran_ID, restaurant_Name = restaurant.restaurant_Name, restaurant_Address = restaurant.restaurant_Address, restaurant_ContactNo = restaurant.restaurant_PhoneNumber, website = restaurant.restraurant_Website, opening_Time = restaurant.opening_Time, closing_Time = restaurant.closing_Time, xaxis = restaurant.xaxis, yaxis = restaurant.yaxis }; restaurantInformationList.Add(restaurantDetails); } } return(restaurantInformationList.AsQueryable()); } catch (Exception ex) { throw ex; } }
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; } }