public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteAttributeSetInstanceExtensionFieldDto value) { var idObj = id; if (value.Name == null) { value.Name = idObj; } else if (!((ICreateOrMergePatchOrDeleteAttributeSetInstanceExtensionField)value).Name.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.Name); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteAttributeSetInstanceExtensionFieldDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; AttributeSetInstanceExtensionFieldsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetInstanceExtensionFieldApplicationService.When(value as IMergePatchAttributeSetInstanceExtensionField); return; } // /////////////////////////////// AttributeSetInstanceExtensionFieldsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeSetInstanceExtensionFieldApplicationService.When(value as ICreateAttributeSetInstanceExtensionField); } catch (Exception ex) { var response = AttributeSetInstanceExtensionFieldsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }