Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 public static ActionResult Post(Post post)
 {
     return MVC.Posts.Get(post.CreatedAt.Year, post.CreatedAt.Month, post.CreatedAt.Day, post.Slug);
 }
Exemplo n.º 3
0
 public static HtmlString PostLink(this HtmlHelper html, Post post, string linkText = null)
 {
     linkText = linkText ?? post.Title;
     return html.ActionLink(linkText, LinkTo.Post(post));
 }