public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteLocatorTypeDto value) { var idObj = id; if (value.LocatorTypeId == null) { value.LocatorTypeId = idObj; } else if (!((ICreateOrMergePatchOrDeleteLocatorType)value).LocatorTypeId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.LocatorTypeId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteLocatorTypeDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; LocatorTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _locatorTypeApplicationService.When(value as IMergePatchLocatorType); return; } // /////////////////////////////// LocatorTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _locatorTypeApplicationService.When(value as ICreateLocatorType); } catch (Exception ex) { var response = LocatorTypesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }