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