public ActionResult Edit(Ingredient ingredient) { if (ModelState.IsValid) { db.Ingredients.Attach(ingredient); db.ObjectStateManager.ChangeObjectState(ingredient, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(ingredient); }
public ActionResult Create(Ingredient ingredient) { if (ModelState.IsValid) { db.Ingredients.AddObject(ingredient); db.SaveChanges(); return RedirectToAction("Index"); } return View(ingredient); }
/// <summary> /// Deprecated Method for adding a new object to the Ingredients EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToIngredients(Ingredient ingredient) { base.AddObject("Ingredients", ingredient); }
/// <summary> /// Create a new Ingredient object. /// </summary> /// <param name="ingredientID">Initial value of the IngredientID property.</param> public static Ingredient CreateIngredient(global::System.Int32 ingredientID) { Ingredient ingredient = new Ingredient(); ingredient.IngredientID = ingredientID; return ingredient; }