public void Create(Food food) { using (CocktailDBContext context = new CocktailDBContext()) { context.Foods.Add(food); context.SaveChanges(); } }
public void DeleteAll() { using (CocktailDBContext context = new CocktailDBContext()) { context.Foods.RemoveRange(context.Foods); context.SaveChanges(); } }
public void Create(Ingredient ingredient) { using (CocktailDBContext context = new CocktailDBContext()) { context.Ingredients.Add(ingredient); context.SaveChanges(); } }
public void Update(Cocktail cocktail) { using (CocktailDBContext context = new CocktailDBContext()) { context.Update(cocktail); context.SaveChanges(); } }
public void DeleteAll() { using (CocktailDBContext context = new CocktailDBContext()) { context.Ingredients.RemoveRange(context.Ingredients); context.Cocktails.RemoveRange(context.Cocktails); context.SaveChanges(); } }
public void Create(Cocktail cocktail) { using (CocktailDBContext context = new CocktailDBContext()) { context.Cocktails.Add(cocktail); context.Ingredients.AddRange(cocktail.IngredientDescription); context.SaveChanges(); } }
public void Delete(string key) { using (CocktailDBContext context = new CocktailDBContext()) { Cocktail cocktail = Get(key); context.Ingredients.RemoveRange(cocktail.IngredientDescription); context.Cocktails.Remove(cocktail); context.SaveChanges(); } }