예제 #1
0
        public async Task <BlogPostsResult> GetBlogPostsByProjectId(string projectId)
        {
            var results = await _blogPostRepository.GetBlogPostsByProjectId(projectId);

            if (results.Count == 0)
            {
                return new BlogPostsResult
                       {
                           Data    = results,
                           Details = new ResultDetails
                           {
                               Message      = $"No blog posts for project with id of {projectId} were found.",
                               ResultStatus = ResultStatus.Warning
                           }
                       }
            }
            ;

            return(new BlogPostsResult
            {
                Data = results,
                Details = new ResultDetails {
                    ResultStatus = ResultStatus.Success
                }
            });
        }