Ejemplo n.º 1
0
        public async Task Store(RoadmapForm form)
        {
            var roadmap = new Roadmap {
                Title   = form.Title,
                Summary = form.Summary,
            };

            var roadmapTags = form.Tags
                              .Select(tagId => new Tag // First we take our form.tags and convert it to Tag objects
            {
                TagName = tagId
            })
                              .Select(tag => new RoadmapTag // Then we take the result of the previous conversion and we
            {                                               // transform again to RoadmapTags, we even could do this in one pass
                Roadmap = roadmap,                          // but this way is more clear what the transformations are
                Tag     = tag
            })
                              .ToList();

            _dbContext.AddRange(roadmapTags);
            await _dbContext.SaveChangesAsync();

            _searchEngine.addDocument(roadmap);
        }
Ejemplo n.º 2
0
 public void AddRange(IEnumerable <object> entities)
 {
     _repoContext.AddRange(entities);
 }