// // GET: /Wiki/Create/name public ActionResult Create(string Title) { if (!User.Identity.IsAuthenticated) { return RedirectToAction("Index"); } Article a = new Article(); a.Title = Title; Article_section sec = new Article_section(); //sec.Pub_date = DateTime.Now; a.Article_section.Add(sec); return View(a); }
// // GET: /Wiki/Edit/Start public ActionResult Edit(string Title) { Article art = new Article(); try { var article = from a in db.Articles where a.Title == Title select a; art = article.ToArray()[0]; } catch (IndexOutOfRangeException) { return RedirectToAction("/Create/" + Title); } return View(art); }
/// <summary> /// Create a new Article object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="pub_date">Initial value of the Pub_date property.</param> public static Article CreateArticle(global::System.Int32 id, global::System.String title, global::System.DateTime pub_date) { Article article = new Article(); article.Id = id; article.Title = title; article.Pub_date = pub_date; return article; }
// // GET: /Wiki/Details/5 public ActionResult Details(string Title) { if (Title == null) { Title = "Start"; } var db_article = from a in db.Articles where a.Title == Title select a; Article article; if (db_article.ToList().Count == 0) { article = new Article { Title = Title, }; } else { article = db_article.ToArray()[0]; foreach (Article_section section in article.Article_section) { section.Section_text = WikiToHtml.To_html(section.Section_text); section.Section_heading = WikiToHtml.To_html(section.Section_heading); } } return View(article); }
/// <summary> /// Deprecated Method for adding a new object to the Articles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToArticles(Article article) { base.AddObject("Articles", article); }