Exemplo n.º 1
0
 public ActionResult Submit(RecipeDetailsModel insert)
 {
     if (ModelState.IsValid)
     {
         int id = ro.AddRecipe(insert);
         return RedirectToAction("FullDetails", new { id = id });
     }
     else
     {
         return View("RecipeSubmit");
     }
 }
Exemplo n.º 2
0
 public ActionResult Submit(RecipeDetailsModel insert)
 {
     if (ModelState.IsValid)
     {
         int id = ro.AddRecipe(insert);
         return(RedirectToAction("FullDetails", new { id = id }));
     }
     else
     {
         return(View("RecipeSubmit"));
     }
 }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
 public ActionResult Edit(int id, RecipeDetailsModel edit)
 {
     ro.EditRecipe(id,edit);
     return RedirectToAction("FullDetails", new { id = id });
 }
Exemplo n.º 5
0
 public ActionResult Edit(int id, RecipeDetailsModel edit)
 {
     ro.EditRecipe(id, edit);
     return(RedirectToAction("FullDetails", new { id = id }));
 }
Exemplo n.º 6
0
 public void EditRecipe(int id, RecipeDetailsModel receptModell)
 {
     //Recipes[id].Name = receptModell.Name;
 }