public ActionResult <List <GetAllRestaurants> > GetRestaurantsByType(int restaurantTypeId) { try { var result = _repository.GetRestaurantsByType(restaurantTypeId); IMapper mapper = EDeliveryProfile.GetAllRestaurants(); return(mapper.Map <List <GetAllRestaurants> >(result)); } catch (Exception ex) { _logger.LogError($"Failed to get Restaurants by the given Restaurant Type Id:{ex}"); return(BadRequest("Failed to get the Restaurants by the given Restaurant Type Id")); } }
public ActionResult <GetAllRestaurants[]> GetAllRestaurants() { try { var result = _repository.GetAllRestaurants(); IMapper mapper = EDeliveryProfile.GetAllRestaurants(); return(mapper.Map <GetAllRestaurants[]>(result)); } catch (Exception ex) { _logger.LogError($"Failed to get all Restaurants:{ex}"); return(BadRequest("Failed to get all Restaurants: ")); } }