public ResponseWrapper <CreateRelationshipModel> CreateRelationship(CreateRelationshipInputModel model) { var newEntity = new Relationship { RelationshipType = model.RelationshipType, ParentEntityEntityId = model.ParentEntityEntityId, ChildEntityEntityId = model.ChildEntityEntityId, }; context .Relationships .Add(newEntity); context.SaveChanges(); var response = new CreateRelationshipModel { RelationshipId = newEntity.RelationshipId, RelationshipType = newEntity.RelationshipType, ParentEntityEntityId = newEntity.ParentEntityEntityId, ChildEntityEntityId = newEntity.ChildEntityEntityId, }; return(new ResponseWrapper <CreateRelationshipModel>(_validationDictionary, response)); }
public dynamic CreateRelationship([FromBody] CreateRelationshipInputModel model) { var orchestrator = new RelationshipOrchestrator(new ModelStateWrapper(this.ModelState)); return(orchestrator.CreateRelationship(model).GetResponse()); }