コード例 #1
0
        public IActionResult GetRecipeFromStep(int stepId)
        {
            if (!_stepRepository.StepExists(stepId))
            {
                return(NotFound());
            }

            var recipe = _stepRepository.GetRecipeOfAStep(stepId);

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var recipeDto = new RecipeDto()
            {
                Id          = recipe.Id,
                Name        = recipe.Name,
                Description = recipe.Description,
                PublishDate = recipe.PublishDate
            };

            return(Ok(recipeDto));
        }