Beispiel #1
0
        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"));
            }
        }
Beispiel #2
0
        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"));
            }
        }