public static ParticipantAggregate Map(string challengeId, ChallengeParticipantDto participant, IEnumerable <DoxatagDto> doxatags) { return(new ParticipantAggregate { Id = participant.Id, ChallengeId = challengeId, UserId = participant.UserId, Doxatag = doxatags.SingleOrDefault(doxatag => doxatag.UserId == participant.UserId), Score = participant.Score, Matches = { participant.Matches.OrderBy(match => match.GameStartedAt) } }); }
public RepeatedField <ChallengeMatchDto> Resolve( Participant participant, ChallengeParticipantDto participantResponse, IReadOnlyCollection <IMatch> matches, RepeatedField <ChallengeMatchDto> matchResponses, ResolutionContext context ) { foreach (var match in matches) { var matchResponse = context.Mapper.Map <ChallengeMatchDto>(match); matchResponse.ParticipantId = participant.Id; matchResponses.Add(matchResponse); } return(matchResponses); }