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

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

                OrderRoleMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                _orderRoleMvoApplicationService.When(value as ICreateOrderRoleMvo);
            } catch (Exception ex) { var response = OrderRoleMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }