Ejemplo n.º 1
0
        public static RegixPerson ToEntity(this RegixPersonModel model)
        {
            if (model == null)
            {
                return(null);
            }

            RegixPerson entity = new RegixPerson
            {
                Identifier  = model.Identifier,
                FirstName   = model.FirstName,
                MiddleName  = model.MiddleName,
                LastName    = model.LastName,
                DateOfBirth = model.DateOfBirth.HasValue == true?DateTime.SpecifyKind(model.DateOfBirth.Value, DateTimeKind.Utc) : default(DateTime?),
                                  DateOfDeath = model.DateOfDeath.HasValue == true?DateTime.SpecifyKind(model.DateOfDeath.Value, DateTimeKind.Utc) : default(DateTime?),
                                                    RequestId = model.RequestId,
                                                    UpdatedAt = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc),
            };

            return(entity);
        }
Ejemplo n.º 2
0
        public static RegixPersonModel ToModel(this RegixPerson entity)
        {
            if (entity == null)
            {
                return(null);
            }

            RegixPersonModel model = new RegixPersonModel
            {
                Id          = entity.Id,
                Identifier  = entity.Identifier,
                FirstName   = entity.FirstName,
                MiddleName  = entity.MiddleName,
                LastName    = entity.LastName,
                DateOfBirth = entity.DateOfBirth.HasValue == true?DateTime.SpecifyKind(entity.DateOfBirth.Value, DateTimeKind.Utc) : default(DateTime?),
                                  DateOfDeath = entity.DateOfDeath.HasValue == true?DateTime.SpecifyKind(entity.DateOfDeath.Value, DateTimeKind.Utc) : default(DateTime?),
                                                    RequestId = entity.RequestId,
                                                    UpdatedAt = entity.UpdatedAt.HasValue == true?DateTime.SpecifyKind(entity.UpdatedAt.Value, DateTimeKind.Utc) : default(DateTime?),
            };

            return(model);
        }