public async Task <FamilyMember> Handle(AddFamilyMemberCommand request, CancellationToken cancellationToken) { var result = await _familyMembersRepository.AddFamilyMemberAsync( new FamilyMember( Guid.NewGuid(), request.Firstname, request.Lastname, request.BirthDate, request.DeathDate, request.Congregation)); if (request.Relationships != null) { await _familyMembersRepository.AddRelationshipsAsync( new FamilyMember( result.Id, request.Firstname, request.Lastname, request.BirthDate, request.DeathDate, request.Congregation), request.Relationships.ToDictionary( rel => rel.Key, rel => (Relationships)Enum.Parse(typeof(Relationships), rel.Value.ToString()))); } return(new FamilyMember( result.Id, result.Firstname, result.Lastname, result.BirthDate, result.DeathDate, result.Congregation)); }
public async Task AddRelationshipsAsync(FamilyMember familyMember, Dictionary <Guid, Relationships> relationships) { await _familyMembersRepository.AddRelationshipsAsync(familyMember, relationships); }