コード例 #1
0
        private ContactConfigurationRM CreateContactConfigurationForContact(Commands.V1.Contact.ContactConfiguration.CreateForContact cmd)
        {
            ContactConfiguration contactConfiguration = ContactConfiguration.Create(_contactConfigurations++, cmd.StartDate,
                                                                                    cmd.StatusCodeId, cmd.EndDate, cmd.ContactId, cmd.FacilityId, cmd.ContactTypeId, cmd.Priority);

            if (_repository.ContactConfigurationExistsForContact(contactConfiguration, cmd.ContactId))
            {
                throw new InvalidOperationException($"ContactConfiguration with ContactId {cmd.ContactId} already exists");
            }

            _repository.AddContactConfigurationForContact(contactConfiguration, cmd.ContactId);

            return(Conversions.GetContactConfigurationRM(contactConfiguration));
        }