public ActionResult CreateComment(string text) { // creates a comment below the current page var comment = Engine.Definitions .CreateInstance<CommentPart>(CurrentPage); comment.Text = Server.HtmlEncode(text); // the zone name property determines a part's zone comment.ZoneName = "Comments"; Engine.Persister.Save(comment); return Redirect(CurrentPage.Url); } That was an example creating a comment part in the zone. ”Comments” public ActionResult ReadComment(int id) { var comment = Engine.Persister.Get<CommentPart>(id); return Content(comment.Text); } That was an example getting a comment and returning its text. public ActionResult UpdateComment(int id, string text) { var comment = Engine.Persister.Get<CommentPart>(id); comment.Text = Server.HtmlEncode(text); Engine.Persister.Save(comment); return Redirect(CurrentPage.Url); } That was an example updating the text of a comment. public ActionResult DeleteComment(int id) { var comment = Engine.Persister.Get<CommentPart>(id); Engine.Persister.Delete(comment); return Redirect(CurrentPage.Url); } That was an example deleting a comment. public ActionResult Create1000Children() { // this is a way to give your site a good workout for (int i = 0; i < 1000; i++) { var = Engine.Definitions.CreateInstance<HomePage>(CurrentPage); child.Title = "Child page " + i; child.Name = "page" + i; child.Text = "<p>Lorem ipsum dolor sit amet</p>"; child.AddTo(CurrentPage); } // saves all the children in one go Engine.Persister.Save(CurrentPage); return Redirect(CurrentPage.Url); }
public ActionResult CreateComment(string text) { // creates a comment below the current page var comment = Engine.Definitions .CreateInstance<CommentPart>(CurrentPage); comment.Text = Server.HtmlEncode(text); // the zone name property determines a part's zone comment.ZoneName = "Comments"; Engine.Persister.Save(comment); return Redirect(CurrentPage.Url); } That was an example creating a comment part in the ”Comments” zone. public ActionResult ReadComment(int id) { var comment = Engine.Persister.Get<CommentPart>(id); return Content(comment.Text); } That was an example getting a comment and returning its text. public ActionResult UpdateComment(int id, string text) { var comment = Engine.Persister.Get<CommentPart>(id); comment.Text = Server.HtmlEncode(text); Engine.Persister.Save(comment); return Redirect(CurrentPage.Url); } That was an example updating the text of a comment. public ActionResult DeleteComment(int id) { var comment = Engine.Persister.Get<CommentPart>(id); Engine.Persister.Delete(comment); return Redirect(CurrentPage.Url); } That was an example deleting a comment. public ActionResult Create1000Children() { // this is a way to give your site a good workout for (int i = 0; i < 1000; i++) { var = Engine.Definitions.CreateInstance<HomePage>(CurrentPage); child.Title = "Child page " + i; child.Name = "page" + i; child.Text = "<p>Lorem ipsum dolor sit amet</p>"; child.AddTo(CurrentPage); } // saves all the children in one go Engine.Persister.Save(CurrentPage); return Redirect(CurrentPage.Url); }