/// <summary>
        /// 新增或更改企业联系表
        /// </summary>
        public async Task CreateOrUpdateContactAsync(CreateOrUpdateContactInput input)
        {
            using (var _unitWork = UnitOfWorkManager.Begin())
            {
                int contactId = 0;
                if (input.ContactEditDto.Id.HasValue)
                {
                    await UpdateContactAsync(input.ContactEditDto);

                    contactId = input.ContactEditDto.Id.Value;
                }
                else
                {
                    var model = await CreateContactAsync(input.ContactEditDto);

                    contactId = model.Id.Value;
                }

                if (input.ContactEditDto.IsDefault)
                {
                    await SetContactDefault(input.ContactEditDto.CompanyId, contactId);
                }


                _unitWork.Complete();
            }
        }
Beispiel #2
0
        public async Task <long> CreateOrUpdateContact(CreateOrUpdateContactInput input)
        {
            long value;

            if (!input.Contact.Id.HasValue)
            {
                long num = await this._contactRepository.InsertAndGetIdAsync(input.Contact.MapTo <Contact>());

                value = num;
            }
            else
            {
                value = input.Contact.Id.Value;
                await this._contactRepository.UpdateAsync(input.Contact.MapTo <Contact>());
            }
            return(value);
        }