How to update existing CustomerContact in Commerce?

Vote:
 

How to update existing CustomerContact in Commerce? We have UpdateContactAddress and UpdateCreditCard. But i want to update firstname, Lastname etc in CustomerContact..

#203140
Edited, Apr 10, 2019 7:13
Vote:
 

You can just set those properties directly then call .SaveChanges to persist them

#203165
Apr 10, 2019 7:50
Vote:
 

When I call SaveChanges , I am getting the error below.

Violation of PRIMARY KEY constraint 'PK__cls_Addr__091C2AFB0A47054F'. Cannot insert duplicate key in object 'dbo.cls_Address'. The duplicate key value is (9ddf0897-569d-49f5-ad42-9431798187be)

#203167
Apr 10, 2019 8:20
Vote:
 

How does your code look like?

#203168
Apr 10, 2019 8:26
Vote:
 

Ok I fixed it by removing the line below. I think AddContactAddress tries to create new one while saving. SaveChanges works. Thanks.

contact.AddContactAddress(billingAddress);
#203171
Apr 10, 2019 9:11
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.