public IActionResult SearchRestaurantBasedOnMenu([FromBody] AdditionalFeatureForSearch additionalFeatureForSearch)
        {
            IQueryable <RestaurantInformation> restaurantDetails;

            restaurantDetails = business_Repo.GetRestaurantsBasedOnMenu(additionalFeatureForSearch);
            if (restaurantDetails != null)
            {
                return(this.Ok(restaurantDetails));
            }
            return(this.StatusCode((int)HttpStatusCode.InternalServerError, string.Empty));
        }
示例#2
0
        public IQueryable <RestaurantInformation> GetRestaurantsBasedOnMenu(AdditionalFeatureForSearch additionalFeatureForSearch)
        {
            try
            {
                List <RestaurantInformation>                     restaurant_Info = new List <RestaurantInformation>();
                IQueryable <RestaurantSearchDetails>             searched_Restaurant;
                DataLayer.DataEntity.AddtitionalFeatureForSearch searchCritera = new DataLayer.DataEntity.AddtitionalFeatureForSearch
                {
                    cuisine = (string.IsNullOrEmpty(additionalFeatureForSearch.cuisine) ? "" : additionalFeatureForSearch.cuisine),
                    Menu    = (string.IsNullOrEmpty(additionalFeatureForSearch.Menu) ? "" : additionalFeatureForSearch.Menu),
                    rating  = (additionalFeatureForSearch.rating != null && additionalFeatureForSearch.rating > 0) ? additionalFeatureForSearch.rating : 0
                };

                searched_Restaurant = search_Repository.GetRestaurantsBasedOnMenu(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;
            }
        }