コード例 #1
0
        public async Task CreateTagIfNotExists(IEnumerable <string> tags)
        {
            var existingTags = await _tagRepository.GetTagsByName(tags);

            var tagsToBeInserted = tags.Where(tagName => !existingTags.Any(x => x.Name == tagName))
                                   .Select(tagName => new Tag(tagName));

            await _tagRepository.CreateManyTags(tagsToBeInserted);
        }