예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public async Task Delete(IArticleCategories Entity)
 {
     await this.Delete(Entity.Id);
 }
예제 #4
0
 public ArticleCategoryTableEntity(IArticleCategories tags) : this(tags.Tags, tags.Id)
 {
 }
예제 #5
0
 public void Deconstruct(out IClientArticle clientArticle, out IArticleCategories tags, out IArticleCategories cats)
 {
     clientArticle = new BaseArticle(this);
     tags          = new ArticleTags(this);
     cats          = new ArticleCategories(this);
 }
예제 #6
0
 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;
 }