public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteGoodIdentificationMvoDto value) { var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize()); if (value.ProductGoodIdentificationId == null) { value.ProductGoodIdentificationId = idObj; } else if (!((ICreateOrMergePatchOrDeleteGoodIdentificationMvo)value).ProductGoodIdentificationId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.ProductGoodIdentificationId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteGoodIdentificationMvoDto value) { try { // /////////////////////////////// if (value.ProductVersion != default(long)) { value.CommandType = CommandType.MergePatch; GoodIdentificationMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _goodIdentificationMvoApplicationService.When(value as IMergePatchGoodIdentificationMvo); return; } // /////////////////////////////// GoodIdentificationMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _goodIdentificationMvoApplicationService.When(value as ICreateGoodIdentificationMvo); } catch (Exception ex) { var response = GoodIdentificationMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }