public async Task SetSuggestions() { var allTags = await _draftRepository.GetTags(); var highlightsByContent = await _contentRepository.GetHighlights(allTags); foreach (var highlights in highlightsByContent) { var contentId = Guid.Parse(highlights.Key); var tags = await _draftRepository.GetTags(contentId); var draftSuggestions = GetTagSuggestion(contentId, highlights.Value, tags); if (draftSuggestions.Tags.Any()) { var entrySuggestions = await _draftRepository.Get(draftSuggestions.Tags); try { var entryRelationship = await _draftRelationshipRepository.Get(contentId); draftSuggestions.SetDraftSuggestions(entrySuggestions, entryRelationship); } catch (NotFoundException) { draftSuggestions.SetDraftSuggestions(entrySuggestions, null); } } await _draftSuggestionsRepository.Save(draftSuggestions); } }
public async Task <IActionResult> Get() { return(await Execute(async() => await _draftRepository.GetTags())); }