public ActionResult <List <FoodCategoryByID> > GetAllFoodCategories() { try { var result = _repository.GetAllFoodCategories(); IMapper mapper = EDeliveryProfile.GetFoodCategoryByID(); return(mapper.Map <List <FoodCategoryByID> >(result)); } catch (Exception ex) { _logger.LogError($"Failed to get all food categories:{ex}"); return(BadRequest("Failed to get all food categories")); } }
public ActionResult <FoodCategoryByID> GetFoodCategoryByID(int foodCategoryID) { try { var result = _repository.GetFoodCategoryByID(foodCategoryID); IMapper mapper = EDeliveryProfile.GetFoodCategoryByID(); return(mapper.Map <FoodCategoryByID>(result)); } catch (Exception ex) { _logger.LogError($"Failed to get the Food category:{ex}"); return(BadRequest("Failed to get the Food category")); } }