コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            RecipeIngredientBridge recipeIngredientBridge = db.RecipeIngredientBridges.Find(id);

            db.RecipeIngredientBridges.Remove(recipeIngredientBridge);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "RecipeID,IngredientID,IngredientName,MeasurementType,MeasurementQuantity")] RecipeIngredientBridge recipeIngredientBridge)
 {
     if (ModelState.IsValid)
     {
         db.Entry(recipeIngredientBridge).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IngredientID = new SelectList(db.Ingredients, "IngredientID", "IngredientName", recipeIngredientBridge.IngredientID);
     ViewBag.RecipeID     = new SelectList(db.Recipes, "RecipeID", "RecipeName", recipeIngredientBridge.RecipeID);
     return(View(recipeIngredientBridge));
 }
コード例 #3
0
        // GET: RecipeIngredientBridges/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RecipeIngredientBridge recipeIngredientBridge = db.RecipeIngredientBridges.Find(id);

            if (recipeIngredientBridge == null)
            {
                return(HttpNotFound());
            }
            return(View(recipeIngredientBridge));
        }
コード例 #4
0
        // GET: RecipeIngredientBridges/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RecipeIngredientBridge recipeIngredientBridge = db.RecipeIngredientBridges.Find(id);

            if (recipeIngredientBridge == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IngredientID = new SelectList(db.Ingredients, "IngredientID", "IngredientName", recipeIngredientBridge.IngredientID);
            ViewBag.RecipeID     = new SelectList(db.Recipes, "RecipeID", "RecipeName", recipeIngredientBridge.RecipeID);
            return(View(recipeIngredientBridge));
        }