public void Insert(PrivateRecipe t) { using (var ctx = new RecipeTraderModelContext()) { ctx.PrivateRecipes.Add(t); ctx.SaveChanges(); } }
public PrivateRecipe GetById(int id) { using (var ctx = new RecipeTraderModelContext()) { var recipe = ctx.PrivateRecipes.Include(r => r.Items).FirstOrDefault(r => r.Id == id); return recipe; } }