public static void SetNullIdOrThrowOnInconsistentIds(string id, CreateOrMergePatchOrDeleteInOutLineMvoDto value) { var idObj = ParseIdString(id.IsNormalized() ? id : id.Normalize()); if (value.InOutLineId == null) { value.InOutLineId = idObj; } else if (!((ICreateOrMergePatchOrDeleteInOutLineMvo)value).InOutLineId.Equals(idObj)) { throw DomainError.Named("inconsistentId", "Argument Id {0} NOT equals body Id {1}", id, value.InOutLineId); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteInOutLineMvoDto value) { try { // /////////////////////////////// if (value.InOutVersion != default(long)) { value.CommandType = CommandType.MergePatch; InOutLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inOutLineMvoApplicationService.When(value as IMergePatchInOutLineMvo); return; } // /////////////////////////////// InOutLineMvosControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inOutLineMvoApplicationService.When(value as ICreateInOutLineMvo); } catch (Exception ex) { var response = InOutLineMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }