Exemple #1
0
 public ActionResult Create(FormCollection form)
 {
     try
     {
         using (var context  = new SiteContainer())
         {
             var content = new Content();
             TryUpdateModel(content, new[] { "Title", "SeoDescription", "SeoKeywords","SortOrder" });
             content.Text = HttpUtility.HtmlDecode(form["Text"]);
             content.ContentType = form["isProject"]=="on" ? 1 : 0;
             context.AddToContent(content);
             context.SaveChanges();
             return RedirectToAction("Index", "Home", new {area = ""});
         }
     }
     catch
     {
         return View();
     }
 }
Exemple #2
0
 /// <summary>
 /// Create a new Content object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="contentType">Initial value of the ContentType property.</param>
 /// <param name="sortOrder">Initial value of the SortOrder property.</param>
 public static Content CreateContent(global::System.Int32 id, global::System.String title, global::System.Int32 contentType, global::System.Int32 sortOrder)
 {
     Content content = new Content();
     content.Id = id;
     content.Title = title;
     content.ContentType = contentType;
     content.SortOrder = sortOrder;
     return content;
 }
Exemple #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Content EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToContent(Content content)
 {
     base.AddObject("Content", content);
 }