public async Task <IArticleCategories> Update(IArticleCategories Entity) { // updating here means, checking to see if we actually had any to begin with. // If not then we are actually adding!. var existing = await this.Get(Entity.Id); var tagTable = await _tableStore.Value; var queue = await _QueueStore.Value; if (existing != null) { var updated = new ArticleCategoryTableEntity(Entity) { ETag = "*" }; await tagTable.Replace(updated); } else { await this.Create(Entity); } await queue.InsertIntoQueue(JsonConvert.SerializeObject(new QueueMessage { ArticleId = Entity.Id, Status = QueueMessageStatus.Updated })); return(Entity); }
public async Task <IArticleCategories> Create(IArticleCategories Entity) { var tagTable = await _tableStore.Value; var queue = await _QueueStore.Value; await tagTable.Insert(new ArticleCategoryTableEntity(Entity)); // no wait! We also need to update statistics await queue.InsertIntoQueue(JsonConvert.SerializeObject(new QueueMessage { ArticleId = Entity.Id, Status = QueueMessageStatus.Added })); return(Entity); }
public async Task Delete(IArticleCategories Entity) { await this.Delete(Entity.Id); }
public ArticleCategoryTableEntity(IArticleCategories tags) : this(tags.Tags, tags.Id) { }
public void Deconstruct(out IClientArticle clientArticle, out IArticleCategories tags, out IArticleCategories cats) { clientArticle = new BaseArticle(this); tags = new ArticleTags(this); cats = new ArticleCategories(this); }
public CompleteClientArticle(IClientArticle article, IArticleCategories tags, IArticleCategories categories) : this(article.Url, article.Title, article.Synopsis, article.Article, article.Author, tags.Tags, categories.Tags, article.Created, article.Published, article.Updated, article.Available) { Id = article.Id; }