Exemplo n.º 1
0
        public FoodWithProductModel GetFood(long foodId)
        {
            var food = _groceryStoreRepository.GetFood(foodId);

            if (food == null)
            {
                throw new NotFoundItemException($"The food with id: {foodId} does not exist.");
            }
            var foodWithProducts = new FoodWithProductModel(_mapper.Map <FoodModel>(food));

            //foodWithProducts.Products = //THIS IS BEEING FIXED with a repository to avoid Ciclic Dependency
            return(foodWithProducts);
        }