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)); }
public async Task <ICompletePost> Get(string Url) { logger.LogInformation($"Get Post by Url: {Url}"); 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.GetByUrl(Url); var tags = await tagService.Get(post.Id); var cats = await categoryService.Get(post.Id); return(new CompleteBlogEntry(post, tags, cats)); }
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); }