public IActionResult Get(string name) { var recipe = RecipeData.getRecipeData(name); if (recipe == null) { return(NotFound("No recipe found.")); } return(Ok(recipe)); }
public IActionResult SaveRecipe(Recipe recipe) { var _recipes = RecipeData.getRecipeData(); if (RecipeData.noDuplicated(_recipes, recipe) == false) { return(NotFound("Recipe already exists")); } _recipes.Add(recipe); if (_recipes.Count == 0) { return(NotFound("No List Found.")); } RecipeData.writeData(_recipes); return(Ok(_recipes)); }
public IActionResult DeleteRecipe(string name) { var recipe = RecipeData.getRecipeData(name); if (recipe == null) { return(NotFound("No recipe found.")); } var _recipes = RecipeData.deleteData(name); if (_recipes.Count == 0) { return(NotFound("No list found")); } RecipeData.writeData(_recipes); return(Ok(_recipes)); }
public IActionResult Gets() { var _recipes = RecipeData.getRecipeData(); return(Ok(_recipes)); }