Ejemplo n.º 1
0
 private void CheckCreateArticleConflicts(DbArticle article)
 {
     if (this.context.Articles.CountDocuments(a => a.Title == article.Title) > 0)
     {
         throw new ArticleTitleConflictException();
     }
 }
Ejemplo n.º 2
0
        private async Task CheckUpdateArticleConflicts(DbArticle article)
        {
            var articlesCursor = await this.context.Articles.FindAsync(a => a.Title == article.Title && a.Id != article.Id);

            var articlesWithSameTitle = articlesCursor.ToList();

            if (articlesWithSameTitle.Count > 0)
            {
                throw new ArticleTitleConflictException();
            }
        }