コード例 #1
0
        public virtual IHttpActionResult DeleteContact(Guid contactId)
        {
            Logger.LogDelete("DeleteContact", Request, new [] { contactId.ToString() });

            CustomerContact contact = CustomerContext.Current.GetContactById(contactId);

            if (contact == null)
            {
                return(NotFound());
            }

            try
            {
                // BUG reported to Episerver. #COM-956
                contact.PreferredBillingAddressId  = null;
                contact.PreferredShippingAddressId = null;

                contact.SaveChanges();

                contact.DeleteWithAllDependents();
            }
            catch (Exception exception)
            {
                Logger.Error(exception.Message, exception);
                return(InternalServerError(exception));
            }

            return(Ok());
        }