public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteInventoryItemRequirementEntryMvoDto value) { var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize()); if (value.InventoryItemRequirementEntryId == null) { value.InventoryItemRequirementEntryId = idObj; } else if (!((ICreateOrMergePatchOrDeleteInventoryItemRequirementEntryMvo)value).InventoryItemRequirementEntryId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.InventoryItemRequirementEntryId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteInventoryItemRequirementEntryMvoDto value) { try { // /////////////////////////////// if (value.InventoryItemRequirementVersion != default(long)) { value.CommandType = CommandType.MergePatch; InventoryItemRequirementEntryMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inventoryItemRequirementEntryMvoApplicationService.When(value as IMergePatchInventoryItemRequirementEntryMvo); return; } // /////////////////////////////// InventoryItemRequirementEntryMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inventoryItemRequirementEntryMvoApplicationService.When(value as ICreateInventoryItemRequirementEntryMvo); } catch (Exception ex) { var response = InventoryItemRequirementEntryMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }