Beispiel #1
0
        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);
        }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Texts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTexts(Text text)
 {
     base.AddObject("Texts", text);
 }
Beispiel #4
0
 /// <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;
 }