예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderBlogPostViewModel" /> class.
        /// </summary>
        /// <param name="blogPost">The blog post.</param>
        public RenderBlogPostViewModel(BlogPost blogPost = null)
        {
            if (blogPost != null)
            {
                if (blogPost.Author != null)
                {
                    Author = new RenderBlogPostAuthorViewModel(blogPost.Author);
                }

                ActivationDate = blogPost.ActivationDate;
                ExpirationDate = blogPost.ExpirationDate;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderBlogPostViewModel" /> class.
        /// </summary>
        /// <param name="blogPost">The blog post.</param>
        /// <param name="content">The content.</param>
        public RenderBlogPostViewModel(BlogPost blogPost = null, BlogPostContent content = null)
        {
            if (content != null)
            {
                ActivationDate = content.ActivationDate;
                ExpirationDate = content.ExpirationDate;
            }

            if (blogPost != null)
            {
                if (blogPost.Author != null)
                {
                    Author = new RenderBlogPostAuthorViewModel(blogPost.Author);
                }

                if (content == null)
                {
                    ActivationDate = blogPost.ActivationDate;
                    ExpirationDate = blogPost.ExpirationDate;
                }
            }
        }