public ActionResult AddContent(Content model, FormCollection form) { using (var context = new ContentStorage()) { model.Text = HttpUtility.HtmlDecode(form["Text"]); context.AddToContent(model); context.SaveChanges(); return RedirectToAction("Index", "Home", new { id = model.Name, area = "" }); } }
/// <summary> /// Create a new Content object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="sortOrder">Initial value of the SortOrder property.</param> public static Content CreateContent(global::System.Int32 id, global::System.String name, global::System.Int32 sortOrder) { Content content = new Content(); content.Id = id; content.Name = name; content.SortOrder = sortOrder; return content; }
/// <summary> /// Deprecated Method for adding a new object to the Content EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToContent(Content content) { base.AddObject("Content", content); }