public static MvcHtmlString PostLink(this HtmlHelper helper, Post post)
 {
     return helper.ActionLink(post.Title, "Post", "Blog",
     new
     {
         year = post.PostedOn.Year,
         month = post.PostedOn.Month,
         day = post.PostedOn.Day,
         title = post.UrlSlug
     },
     new
     {
         title = post.Title
     });
 }
Beispiel #2
0
 public PostInput MapEntityToPostInput(Post post)
 {
     return new PostInput
     {
         CategoryId = post.Category.CategoryId,
         Description = post.Description,
         Meta = post.Meta,
         Modified = post.Modified,
         PostedOn = post.PostedOn,
         PostId = post.PostId,
         Published = post.Published,
         ShortDescription = post.ShortDescription,
         TagsIds = ExtractTagsIdsFromTagsList(post.Tags),
         Title = post.Title,
         UrlSlug = post.UrlSlug
     };
 }
Beispiel #3
0
        public Post MapPostInputToExistingEntity(PostInput postInput, Post postEntityToUpdate)
        {
            postEntityToUpdate.Category = MapCategory(postInput.CategoryId);
            postEntityToUpdate.Description = postInput.Description;
            postEntityToUpdate.Meta = postInput.Meta;
            postEntityToUpdate.Modified = postInput.Modified;
            postEntityToUpdate.PostedOn = postInput.PostedOn;
            postEntityToUpdate.Published = postInput.Published;
            postEntityToUpdate.ShortDescription = postInput.ShortDescription;
            postEntityToUpdate.Tags = MapTags(postInput.TagsIds);
            postEntityToUpdate.Title = postInput.Title;
            postEntityToUpdate.UrlSlug = postInput.UrlSlug;

            return postEntityToUpdate;
        }