Exemplo n.º 1
0
 public IActionResult GetDetails(long id)
 {
     try {
         return(Ok(RecipeMapper.map(recipeRepository.GetRecipeById(id))));
     } catch (Exception)
     {
         return(BadRequest());
     }
 }
Exemplo n.º 2
0
 public IEnumerable <RecipeDto> Get([FromQuery] RecipeDifficulty?difficulty)
 {
     if (difficulty == null)
     {
         return(recipeRepository.GetRecipes().Select(r => RecipeMapper.map(r)));
     }
     else
     {
         return(recipeRepository.GetRecipesByDifficulty((RecipeDifficulty)difficulty).Select(r => RecipeMapper.map(r)));
     }
 }