Exemplo n.º 1
0
        public async Task <bool> Retract(Guid PostId)
        {
            var articleService = new ArticleService(ctx, opts, logger);
            var post           = new ClientArticle(await articleService.Get(PostId));
            // post.Published = null;
            var updated = post.WithPublished(null);
            await articleService.Update(updated);

            return(true);
        }
Exemplo n.º 2
0
        public async Task <ICompletePost> Get(Guid Id)
        {
            logger.LogInformation($"Get Post by Id:  {Id}");
            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]);

            var post = await articleService.Get(Id);

            var tags = await tagService.Get(Id);

            var categories = await categoryService.Get(Id);

            return(new CompleteBlogEntry(post, tags, categories));
        }
Exemplo n.º 3
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);
        }