public static UiParticipation FetchShooters(this UiParticipation participation, IShooterCollectionParticipationDataStore shooterCollectionParticipationDataStore, IShooterCollectionDataStore shooterCollectionDataStore, ICollectionShooterDataStore collectionShooterDataStore, IShooterDataStore shooterDataStore, IPersonDataStore personDataStore) { participation.ShooterCollections = new List <UiShooterCollection>(); List <ShooterCollectionParticipation> shooterCollectionParticipations = shooterCollectionParticipationDataStore.FindByIdParticipationId(participation.ParticipationId).ToList(); List <ShooterCollection> shooterCollections = shooterCollectionParticipations.Select(_ => shooterCollectionDataStore.FindById(_.ShooterCollectionId)).ToList(); foreach (ShooterCollection shooterCollection in shooterCollections) { List <CollectionShooter> collectionShooters = collectionShooterDataStore.FindByShooterCollectionId(shooterCollection.ShooterCollectionId).ToList(); participation.ShooterCollections.Add(new UiShooterCollection { CollectionName = shooterCollection.CollectionName, ShooterCollectionId = shooterCollection.ShooterCollectionId, Shooters = collectionShooters.Select(_ => ToUiShooter(shooterDataStore.FindById(_.ShooterId)).FetchPerson(personDataStore)) }); } return(participation); }
public static UiParticipation FetchShooters(this UiParticipation participation, IShooterCollectionParticipationDataStore shooterCollectionParticipationDataStore, IShooterCollectionDataStore shooterCollectionDataStore, ICollectionShooterDataStore collectionShooterDataStore, IShooterDataStore shooterDataStore, IPersonDataStore personDataStore) { participation.ShooterCollections = new List<UiShooterCollection>(); List<ShooterCollectionParticipation> shooterCollectionParticipations = shooterCollectionParticipationDataStore.FindByIdParticipationId(participation.ParticipationId).ToList(); List<ShooterCollection> shooterCollections = shooterCollectionParticipations.Select(_ => shooterCollectionDataStore.FindById(_.ShooterCollectionId)).ToList(); foreach (ShooterCollection shooterCollection in shooterCollections) { List<CollectionShooter> collectionShooters = collectionShooterDataStore.FindByShooterCollectionId(shooterCollection.ShooterCollectionId).ToList(); participation.ShooterCollections.Add(new UiShooterCollection { CollectionName = shooterCollection.CollectionName, ShooterCollectionId = shooterCollection.ShooterCollectionId, Shooters = collectionShooters.Select(_ => ToUiShooter(shooterDataStore.FindById(_.ShooterId)).FetchPerson(personDataStore)) }); } return participation; }