public void Patch(string id, [FromBody] MergePatchAttributeDto value) { try { AttributesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeApplicationService.When(value as IMergePatchAttribute); } catch (Exception ex) { var response = AttributesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Delete(string id, string commandId, string version, string requesterId = default(string)) { try { var value = new DeleteAttributeDto(); value.CommandId = commandId; value.RequesterId = requesterId; value.Version = (long)Convert.ChangeType(version, typeof(long)); AttributesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeApplicationService.When(value as IDeleteAttribute); } catch (Exception ex) { var response = AttributesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteAttributeDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; AttributesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeApplicationService.When(value as IMergePatchAttribute); return; } // /////////////////////////////// AttributesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _attributeApplicationService.When(value as ICreateAttribute); } catch (Exception ex) { var response = AttributesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }