public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteShipmentTypeDto value) { var idObj = id; if (value.ShipmentTypeId == null) { value.ShipmentTypeId = idObj; } else if (!((ICreateOrMergePatchOrDeleteShipmentType)value).ShipmentTypeId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.ShipmentTypeId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteShipmentTypeDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; ShipmentTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _shipmentTypeApplicationService.When(value as IMergePatchShipmentType); return; } // /////////////////////////////// ShipmentTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _shipmentTypeApplicationService.When(value as ICreateShipmentType); } catch (Exception ex) { var response = ShipmentTypesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }