예제 #1
0
        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);
        }
예제 #2
0
 public void DeleteRecipeById(int id)
 {
     _context.Recipes.Remove(GetRecipeById(id));
     _context.SaveChanges();
 }