Beispiel #1
0
        private static Relationship MapRelationshipDtoToRelationship(RelationshipDTO relationshipDTO)
        {
            var relationship = new Relationship()
            {
                Id                  = relationshipDTO.Id,
                DateTimeFrom        = relationshipDTO.DateTimeFrom,
                DateTimeTo          = relationshipDTO.DateTimeTo,
                PersonOneId         = relationshipDTO.PersonOneId,
                PersonTwoId         = relationshipDTO.PersonTwoId,
                RelationshipName    = relationshipDTO.RelationshipName,
                RelationShipDetails = relationshipDTO.RelationShipDetails,
                RelationshipTypeId  = relationshipDTO.RelationshipTypeId,
                RoleOneId           = relationshipDTO.RoleOneId,
                RoleTwoId           = relationshipDTO.RoleTwoId
            };

            if (relationshipDTO.Id.ToString().Length == 36)
            {
                relationship.Id = relationship.Id;
            }

            MetaData.AddMetaData(relationship);

            return(relationship);
        }
Beispiel #2
0
        private static Person MapPersonDtoToPerson(PersonDto p)
        {
            var person = new Person()
            {
                FirstName    = p.FirstName,
                LastName     = p.LastName,
                MiddleName   = p.MiddleName,
                IdCode       = p.IdCode,
                Sex          = (Sex)p.Sex,
                DateOfBirth  = p.DateOfBirth,
                PlaceOfBirth = p.PlaceOfBirth,
                AppUserId    = p.AppUserId,
                // Meta fields
                ChangedAt = DateTime.UtcNow,
                ChangedBy = p.AppUserId
            };

            if (p.Id.ToString().Length == 36)
            {
                person.Id = p.Id;
            }

            MetaData.AddMetaData(person);
            return(person);
        }
Beispiel #3
0
        private static RelationshipRole MapRelationshipRoleDTOToRelationshipRole(RelationshipRoleDTO r)
        {
            var relationship = new RelationshipRole()
            {
                RelationshipRoleName        = r.RelationshipRoleName,
                RelationshipRoleDescription = r.RelationshipRoleDescription
            };

            if (r.Id.ToString().Length == 36)
            {
                relationship.Id = r.Id;
            }

            MetaData.AddMetaData(relationship);

            return(relationship);
        }