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