Exemple #1
0
        private async Task <PostDetailDto> getPostDetailAsync(PostResultDto post)
        {
            if (post == null)
            {
                return(null);
            }

            if (!isItOkToGetDetails(post))
            {
                return(null);
            }

            var result = new PostDetailDto();

            await addRelatedDataToPostDetailAsync(result, post);

            return(await Task.FromResult(result));
        }
Exemple #2
0
        private async Task addRelatedDataToPostDetailAsync(
            PostDetailDto detail,
            PostResultDto post
            )
        {
            detail.Post       = post;
            detail.Categories = await getCategoryItemsAsync(
                post.PostTypeId,
                post.LangId);

            detail.Tags = await getPostTagsAsync(post.Id);

            //detail.Meta = new PostMetaListDto {
            //    LangKey = post.LangKey,
            //    PostSlug = post.Slug,
            //    PostTitle = post.Title,
            //    Items = await getPostMetaAsync(postId, )
            //}
        }
Exemple #3
0
        private bool isItOkToGetDetails(PostResultDto post)
        {
            if (post.WebsiteId != _websiteInfo.Id)
            {
                return(false);
            }

            if (post.Status != PostStatus.Published)
            {
                return(false);
            }

            if (post.Status == PostStatus.Published &&
                post.PublishDate < _dateService.UtcNow())
            {
                return(false);
            }

            return(true);
        }