예제 #1
0
 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);
     }
 }
예제 #2
0
 public void EditRecipe(int id, RecipeDetailsModel receptModell)
 {
     //Recipes[id].Name = receptModell.Name;
 }