public List <RestaurantInformation> SearchForRestaurant(SearchForRestaurant searchDetails) { try { List <RestaurantInformation> RestaurantInfo = new List <RestaurantInformation>(0); // SearchForRestautrant searchInfo = new SearchForRestautrant(); var searchinfo = _mapper.Map <SearchForRestautrant>(searchDetails); var Restaurant = search_Repository.TotalSearchForRestaurant(searchinfo).ToList(); foreach (var item in Restaurant) { var RestaurantInformation = _mapper.Map <RestaurantInformation> (item); RestaurantInfo.Add(RestaurantInformation); } // RestaurantInfo = _mapper.Map<List<RestaurantInformation>>(Restaurant); return(RestaurantInfo); } catch (Exception ex) { throw; } }
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 IActionResult SearchForRestaurant([FromBody] SearchForRestaurant searchDetails) { IQueryable <RestaurantInformation> restaurantDetails; restaurantDetails = business_Repo.SearchForRestaurant(searchDetails); if (restaurantDetails != null) { return(this.Ok(restaurantDetails)); } return(this.StatusCode((int)HttpStatusCode.InternalServerError, string.Empty)); }
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> SearchForRestaurant(SearchForRestaurant searchDetails) { List <RestaurantInformation> restaurant_Info = new List <RestaurantInformation>(); try { DataLayer.DataEntity.SearchForRestautrant searchParms = new SearchForRestautrant() { location = new DataLayer.DataEntity.LocationDetails() { distance = searchDetails.location.distance, xaxis = searchDetails.location.xaxis, yaxis = searchDetails.location.yaxis, restaurant_Name = searchDetails.location.restaurant_Name }, search = new DataLayer.DataEntity.AddtitionalFeatureForSearch() { rating = searchDetails.search.rating, cuisine = searchDetails.search.cuisine, Menu = searchDetails.search.Menu } }; var searchResult = search_Repository.SearchForRestaurant(searchParms); if (searchResult != null) { foreach (var restaurants in searchResult) { 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, Rating = restaurants.Rating }; restaurant_Info.Add(restaurant_Details); } } return(restaurant_Info.AsQueryable()); } catch (Exception ex) { return(restaurant_Info.AsQueryable()); } }
public IActionResult SearchForRestaurant([FromBody] SearchForRestaurant searchDetails) { try { int UserId = (Request.Headers.ContainsKey("CustomerId") ? int.Parse(HttpContext.Request.Headers["CustomerId"]) : 0); loggerService.LogMessage("Received at endpoint : api/SearchForRestaurant : UserID : " + UserId); IQueryable <RestaurantInformation> restaurantDetails; restaurantDetails = business_Repo.SearchForRestaurant(searchDetails); if (restaurantDetails != null) { return(this.Ok(restaurantDetails)); } return(this.StatusCode((int)HttpStatusCode.InternalServerError, string.Empty)); } catch (Exception ex) { loggerService.LogException(ex); return(this.StatusCode((int)HttpStatusCode.InternalServerError, string.Empty)); } }
public IQueryable <RestaurantInformation> SearchForRestaurant(SearchForRestaurant searchDetails) { throw new NotImplementedException(); }