Beispiel #1
0
        public Guid Create(ContactDTO contactDTO)
        {
            if (contactDTO.Identifier.HasValue)
            {
                throw new ParameterException("User guid should not be declared");
            }

            var contact = new Contact()
            {
                Name                = contactDTO.Name,
                BirthDate           = contactDTO.BirthDate,
                PersonalPhoneNumber = contactDTO.PersonalPhoneNumber,
                WorkPhoneNumber     = contactDTO.WorkPhoneNumber,
                Email               = contactDTO.Email,
                Company             = contactDTO.Company,
                // Address = contactDTO.Address,
            };


            return(ContactDataAccess.Create(contact));
        }
Beispiel #2
0
        public ContactDTO Read(Guid guid)
        {
            var contact = ContactDataAccess.Read(guid);

            if (contact == null)
            {
                throw new NotFoundException($"Contact not found");
            }

            var contactDTO = new ContactDTO()
            {
                Identifier          = contact.Identifier,
                Name                = contact.Name,
                BirthDate           = contact.BirthDate,
                PersonalPhoneNumber = contact.PersonalPhoneNumber,
                WorkPhoneNumber     = contact.WorkPhoneNumber,
                Email               = contact.Email,
                Company             = contact.Company,
                ProfileImage        = contact.ProfileImage
            };

            return(contactDTO);
        }