Blog.Logic.Core.PostsLogic.GetPostProperties C# (CSharp) Method

GetPostProperties() public method

public GetPostProperties ( Post post ) : Post
post Blog.Common.Contracts.Post
return Blog.Common.Contracts.Post
        public Post GetPostProperties(Post post)
        {
            var contents = new List<PostContent>();
            var dbContents = _postContentRepository.Find(b => b.PostId == post.Id, true).ToList();
            dbContents.ForEach(b =>
            {
                b.Media.MediaPath = null;
                b.Media.ThumbnailPath = null;
                contents.Add(PostContentMapper.ToDto(b));
            });
            post.PostContents = contents;

            if (post.User.PictureId != null)
                post.User.Picture = MediaMapper.ToDto(_mediaRepository.Find(b => b.MediaId == (int)post.User.PictureId, false).FirstOrDefault());
            if (post.User.BackgroundId != null)
                post.User.Background = MediaMapper.ToDto(_mediaRepository.Find(b => b.MediaId == (int)post.User.BackgroundId, false).FirstOrDefault());

            return post;
        }