private void GetCompletedHymnsBySeason(ServiceHymnInfo[] fetchedHymns, HymnGroup groupDetails) { if (fetchedHymns.Length != 0) { // filter out hymns that have no supported content fetchedHymns = fetchedHymns.Where(h => h.Has_Text || h.Has_Hazzat || h.Has_VerticalHazzat).ToArray(); foreach (var hymnInfo in fetchedHymns) { groupDetails.Add(new ServiceHymnMenuItem() { ItemId = hymnInfo.ItemId, Title = hymnInfo.Title, Structure_Name = hymnInfo.Structure_Name, HasSupportedContent = true }); } // Adding a lock since multiple services could be modifying the collection concurrently lock (HymnGroups) { HymnGroups.Add(groupDetails); } } }
private void GetCompletedHymnsBySeasonAndTypeOrTune(ServiceHymnInfo[] fetchedHymns, HymnGroup groupDetails) { if (fetchedHymns == null) { return; } foreach (var hymnInfo in fetchedHymns) { groupDetails.Add(new ServiceHymnMenuItem() { ItemId = hymnInfo.ItemId, Title = hymnInfo.Title, Structure_Name = hymnInfo.Structure_Name, HasSupportedContent = hymnInfo.Has_Text || hymnInfo.Has_Hazzat || hymnInfo.Has_VerticalHazzat }); } // Adding a lock since multiple services could be modifying the collection concurrently lock (HymnGroups) { HymnGroups.Add(groupDetails); } }