public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteShipmentReceiptMvoDto value) { var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize()); if (value.ShipmentReceiptId == null) { value.ShipmentReceiptId = idObj; } else if (!((ICreateOrMergePatchOrDeleteShipmentReceiptMvo)value).ShipmentReceiptId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.ShipmentReceiptId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteShipmentReceiptMvoDto value) { try { // /////////////////////////////// if (value.ShipmentVersion != default(long)) { value.CommandType = CommandType.MergePatch; ShipmentReceiptMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _shipmentReceiptMvoApplicationService.When(value as IMergePatchShipmentReceiptMvo); return; } // /////////////////////////////// ShipmentReceiptMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _shipmentReceiptMvoApplicationService.When(value as ICreateShipmentReceiptMvo); } catch (Exception ex) { var response = ShipmentReceiptMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }