public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeletePhysicalInventoryLineMvoDto value) { var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize()); if (value.PhysicalInventoryLineId == null) { value.PhysicalInventoryLineId = idObj; } else if (!((ICreateOrMergePatchOrDeletePhysicalInventoryLineMvo)value).PhysicalInventoryLineId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.PhysicalInventoryLineId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeletePhysicalInventoryLineMvoDto value) { try { // /////////////////////////////// if (value.PhysicalInventoryVersion != default(long)) { value.CommandType = CommandType.MergePatch; PhysicalInventoryLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _physicalInventoryLineMvoApplicationService.When(value as IMergePatchPhysicalInventoryLineMvo); return; } // /////////////////////////////// PhysicalInventoryLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _physicalInventoryLineMvoApplicationService.When(value as ICreatePhysicalInventoryLineMvo); } catch (Exception ex) { var response = PhysicalInventoryLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }