public ActionResult <GetFoodById> GetFoodById(int foodID) { try { var result = _repository.GetFoodById(foodID); IMapper mapper = EDeliveryProfile.GetFoodById(); return(mapper.Map <GetFoodById>(result)); } catch (Exception ex) { _logger.LogError($"Failed to return the food:{ex}"); return(BadRequest("Failed to return the food")); } }