public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteOrderItemShipGrpInvReservationDto value) { var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize()); if (value.OrderItemShipGrpInvResId == null) { value.OrderItemShipGrpInvResId = idObj; } else if (!((ICreateOrMergePatchOrDeleteOrderItemShipGrpInvReservation)value).OrderItemShipGrpInvResId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.OrderItemShipGrpInvResId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteOrderItemShipGrpInvReservationDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; OrderItemShipGrpInvReservationsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _orderItemShipGrpInvReservationApplicationService.When(value as IMergePatchOrderItemShipGrpInvReservation); return; } // /////////////////////////////// OrderItemShipGrpInvReservationsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _orderItemShipGrpInvReservationApplicationService.When(value as ICreateOrderItemShipGrpInvReservation); } catch (Exception ex) { var response = OrderItemShipGrpInvReservationsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }