public virtual ActionResult Add(PostAdd postAdd) { if (ModelState.IsValid) { var post = new Post(); Mapper.Map(postAdd, post); post.CreatedAt = DateTime.UtcNow; RavenSession.Store(post); return RedirectToAction(LinkTo.Post(post)); } return View(); }
public static ActionResult Post(Post post) { return MVC.Posts.Get(post.CreatedAt.Year, post.CreatedAt.Month, post.CreatedAt.Day, post.Slug); }
public static HtmlString PostLink(this HtmlHelper html, Post post, string linkText = null) { linkText = linkText ?? post.Title; return html.ActionLink(linkText, LinkTo.Post(post)); }