Exemplo n.º 1
0
        public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteOrderShipGroupMvoDto value)
        {
            var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize());

            if (value.OrderShipGroupId == null)
            {
                value.OrderShipGroupId = idObj;
            }
            else if (!((ICreateOrMergePatchOrDeleteOrderShipGroupMvo)value).OrderShipGroupId.Equals(idObj))
            {
                throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.OrderShipGroupId);
            }
        }
Exemplo n.º 2
0
        public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteOrderShipGroupMvoDto value)
        {
            try {
                // ///////////////////////////////
                if (value.OrderVersion != default(long))
                {
                    value.CommandType = CommandType.MergePatch;
                    OrderShipGroupMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                    _orderShipGroupMvoApplicationService.When(value as IMergePatchOrderShipGroupMvo);
                    return;
                }
                // ///////////////////////////////

                OrderShipGroupMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                _orderShipGroupMvoApplicationService.When(value as ICreateOrderShipGroupMvo);
            } catch (Exception ex) { var response = OrderShipGroupMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }