public IActionResult updateRecipe(List <Recipe> recipeList) { if (recipeList.Count == 0 || recipeList == null) { return(NotFound("Error List")); } RecipeData.writeData(recipeList); return(Ok(recipeList)); }
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)); }