コード例 #1
0
 /// <summary>
 /// The map from.
 /// </summary>
 /// <param name="blogPost">
 /// The blogPost.
 /// </param>
 /// <returns>
 /// The mapped rss element view model.
 /// </returns>
 public RssElementViewModel MapFrom(BlogPost blogPost)
 {
     var link = "http://{0}/read/post/{1}/{2}".FormatWith(HttpContext.Current.Request.Url.Host, blogPost.Blog.Url, blogPost.Url);
    
     return new RssElementViewModel
         {
             Link = link,
             PubDate = blogPost.PostDate.ToRFC822String(), 
             Description = blogPost.Description, 
             Title = blogPost.Title
         };
 }
コード例 #2
0
        /// <summary>
        /// The get model.
        /// </summary>
        /// <param name="url">
        /// The blog url.
        /// </param>
        /// <param name="postUrl">
        /// The post url.
        /// </param>
        /// <returns>
        /// Returns the blog post page view model.
        /// </returns>
        private BlogPostPageViewModel BlogPostView(string url, string postUrl)
        {
            var blog = this.blogTasks.GetBlog(url);

            if (blog == null)
            {
                throw new ResourceException();
            }

            var post = new BlogPost();

            if (!string.IsNullOrEmpty(postUrl))
            {
                post = blog.BlogPosts.FirstOrDefault(x => x.Url.Equals(postUrl, StringComparison.InvariantCultureIgnoreCase));
            }

            var cachedTags = this.cachingProvider.Get<Domain.Tags.Tag>();

            return this.blogPostPageViewModelMapper.MapFrom(blog, post, cachedTags);
        }