public ActionResult Create(Text text) { if (ModelState.IsValid) { db.Texts.AddObject(text); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CatID = new SelectList(db.Categories, "CatID", "CatName", text.CatID); return View(text); }
public ActionResult Edit(Text text) { if (ModelState.IsValid) { db.Texts.Attach(text); db.ObjectStateManager.ChangeObjectState(text, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CatID = new SelectList(db.Categories, "CatID", "CatName", text.CatID); return View(text); }
/// <summary> /// Deprecated Method for adding a new object to the Texts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTexts(Text text) { base.AddObject("Texts", text); }
/// <summary> /// Create a new Text object. /// </summary> /// <param name="textID">Initial value of the TextID property.</param> /// <param name="textData">Initial value of the TextData property.</param> public static Text CreateText(global::System.Int64 textID, global::System.String textData) { Text text = new Text(); text.TextID = textID; text.TextData = textData; return text; }