public int AddRecipe(RecipeDetailsModel receptModell) { ////Utan databas //Recipes.Add(receptModell); //return Recipes.Count-1; using (var db = new RecipesEntities()) { var toAdd = new Recipes { Name = receptModell.Name, Summary = receptModell.Summary, CookingTime = receptModell.CookingTimeInMinutes, Ingredients = receptModell.Ingredients, Instructions = receptModell.Instructions }; db.Recipes.Add(toAdd); db.SaveChanges(); return(toAdd.ID); } }
public void EditRecipe(int id, RecipeDetailsModel receptModell) { //Recipes[id].Name = receptModell.Name; }