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