Beispiel #1
0
        public HttpResponseMessage Delete(int relationshipId)
        {
            var relationship = _relationshipRepository.Get(relationshipId);

            if (relationship == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid relationship."));
            }

            _relationshipService.DeleteRelationship(relationship);
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
        public void OnDeleting(string entityName)
        {
            var relationships = _relationshipService.GetRelationships(entityName);

            if (relationships == null)
            {
                return;
            }
            foreach (var relationship in relationships)
            {
                _relationshipService.DeleteRelationship(relationship);
            }
        }
Beispiel #3
0
        public override void CustomDeleteAction(string fieldType, string fieldName, SettingsDictionary settingsDictionary)
        {
            if (fieldType != "ReferenceField")
            {
                return;
            }
            var relationshipId = int.Parse(settingsDictionary["ReferenceFieldSettings.RelationshipId"]);
            var record         = _repository.Table.FirstOrDefault(x => x.Relationship.Id == relationshipId);

            if (record != null)
            {
                record = _repository.Table
                         .First(x => x.Relationship.Name == record.Relationship.Name &&
                                x.Relationship.RelatedEntity.ContentItemVersionRecord.Latest);
                _relationshipService.DeleteRelationship(record);
            }
        }
 public HttpResponseMessage delete_relationship(RelationshipRequest request)
 {
     return(toJson(_relationshipService.DeleteRelationship(request)));
 }