public virtual async Task DeleteContactAsync(string contactId)
        {
            await _customerApi.DeleteContactsAsync(new[] { contactId });

            //Invalidate cache
            CustomerCacheRegion.ExpireMember(contactId);
        }
        public virtual async Task UpdateContactAsync(Contact contact)
        {
            await _customerApi.UpdateContactAsync(contact.ToContactDto());

            //Invalidate cache
            CustomerCacheRegion.ExpireMember(contact.Id);
        }
        public async Task UpdateOrganizationAsync(Organization organization)
        {
            var orgDto = organization.ToOrganizationDto();
            await _customerApi.UpdateOrganizationAsync(orgDto);

            CustomerCacheRegion.ExpireMember(organization.Id);
        }
        public virtual async Task UpdateContactAddressesAsync(string contactId, IList <Address> addresses)
        {
            var existContact = await GetContactByIdAsync(contactId);

            if (existContact != null)
            {
                await _customerApi.UpdateAddessesAsync(contactId, addresses.Select(x => x.ToCustomerAddressDto()).ToList());

                //Invalidate cache
                CustomerCacheRegion.ExpireMember(existContact.Id);
            }
        }
Esempio n. 5
0
        public override async Task DeleteContactAsync(string contactId)
        {
            try
            {
                await _customerApi.DeleteContactsAsync(new[] { contactId });
            }
            catch (HttpOperationException ex)
            {
                /* Our AutoRestClient throws exception on NoContent status code.
                 * In order not to touch the customer module, we check that the exception status is 'NoContent'
                 * and in this case we continue execution
                 */
                if (!ex.Message.Contains(NO_CONTENT, StringComparison.InvariantCulture))
                {
                    throw;
                }
            }

            //Invalidate cache
            CustomerCacheRegion.ExpireMember(contactId);
        }