public Ingredient EditIngredient(Ingredient ingredient)
        {
            var ingredient1 = _context.Ingredients.FirstOrDefault(i => i.Id == ingredient.Id);

            ingredient1.Name             = ingredient.Name;
            ingredient1.IngredientImage  = ingredient.IngredientImage;
            ingredient1.IsMainIngredient = ingredient.IsMainIngredient;

            _context.SaveChanges();

            return(ingredient);
        }
Beispiel #2
0
 public void DeleteRecipeById(int id)
 {
     _context.Recipes.Remove(GetRecipeById(id));
     _context.SaveChanges();
 }