Beispiel #1
0
        public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteAttributeUseMvoDto value)
        {
            var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize());

            if (value.AttributeSetAttributeUseId == null)
            {
                value.AttributeSetAttributeUseId = new AttributeSetAttributeUseIdDto(idObj);
            }
            else if (!((ICreateOrMergePatchOrDeleteAttributeUseMvo)value).AttributeSetAttributeUseId.Equals(idObj))
            {
                throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.AttributeSetAttributeUseId);
            }
        }
Beispiel #2
0
        public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteAttributeUseMvoDto value)
        {
            try {
                // ///////////////////////////////
                if (value.AttributeSetVersion != default(long))
                {
                    value.CommandType = CommandType.MergePatch;
                    AttributeUseMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                    _attributeUseMvoApplicationService.When(value as IMergePatchAttributeUseMvo);
                    return;
                }
                // ///////////////////////////////

                AttributeUseMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                _attributeUseMvoApplicationService.When(value as ICreateAttributeUseMvo);
            } catch (Exception ex) { var response = AttributeUseMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }