public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeletePicklistBinDto value) { var idObj = id; if (value.PicklistBinId == null) { value.PicklistBinId = idObj; } else if (!((ICreateOrMergePatchOrDeletePicklistBin)value).PicklistBinId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.PicklistBinId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeletePicklistBinDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; PicklistBinsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _picklistBinApplicationService.When(value as IMergePatchPicklistBin); return; } // /////////////////////////////// PicklistBinsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _picklistBinApplicationService.When(value as ICreatePicklistBin); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }