示例#1
0
        public async Task <ICompletePost> Add(ICompletePost post)
        {
            // In the we deconstruct the original message, to easier to manage parts
            logger.LogInformation($"Creating new blog article {post.Title}");
            (var article, var tags, var categories) = new CompleteBlogEntry(post);
            var articleService  = new ArticleService(ctx, opts, logger);
            var tagService      = new TagService(ctx, opts, logger, opts[StorageList.TagTable], opts[StorageList.TagQueue]);
            var categoryService = new CategoryService(ctx, opts, logger, opts[StorageList.CategoryTable], opts[StorageList.CategoryQueue]);

            // INsert and create a new Blog Article
            var entity = await articleService.Create(article);

            // Ditto the tsg, and categories
            var createdTags = await tagService.Create(tags.Tags.ToList(), entity.Id);

            var createdCats = await categoryService.Create(categories.Tags.ToList(), entity.Id);

            var addedEntry = new CompleteBlogEntry(
                await articleService.Get(entity.Id),
                createdTags,
                createdCats);

            return(addedEntry);
        }
示例#2
0
        public Task <IEnumerable <IArticleDetails> > FindArticlDetails(DateTime start, DateTime end, int take, int skip)
        {
            var articleService = new ArticleService(ctx, opts, logger);

            return(articleService.FindArticlDetails(start, end, take, skip));
        }