private ICollection <RelationBetweenEntries> GetRelations(IEntryInstance entry, IEntryProvider entryProvider) { var allRelatedToEntry = entry.Related.AllRelatedPositions; if (IsCollectionEmpty(allRelatedToEntry)) { return(null); } var relations = new List <RelationBetweenEntries>(); var filteredEntries = allRelatedToEntry.Where(r => CanEntryBeAddedToSeries(r.MalId) && !IsIgnored(r.MalId, entryProvider)); foreach (var subItem in filteredEntries) { var relatedEntry = entryProvider.Get(subItem.MalId); if (relatedEntry != null && !HasMultipleParentStories(relatedEntry)) { var relation = CreateRelation(entry, relatedEntry, subItem.RelationType); relations.Add(relation); } } return(relations); }
public ICollection <RelationBetweenEntries> Assembly(long entryId, IEntryProvider entryProvider) { ResetCollections(); if (IsIgnored(entryId, entryProvider)) { return(series); } var entry = entryProvider.Get(entryId); if (HasMultipleParentStories(entry)) { return(series); } AddEntryToCheckTheRelations(entry); while (!IsStackEmpty()) { ResolveTopEntry(entryProvider); } if (series.Count == 0) { series.Add(new RelationBetweenEntries(entry)); } return(series); }