Exemple #1
0
        public dynamic CreateDataSourceRelation([FromBody] CreateDataSourceRelationInputModel model)
        {
            var orchestrator = new DataSourceRelationOrchestrator(new ModelStateWrapper(this.ModelState));

            return(orchestrator.CreateDataSourceRelation(model).GetResponse());
        }
Exemple #2
0
        public ResponseWrapper <CreateDataSourceRelationModel> CreateDataSourceRelation(CreateDataSourceRelationInputModel model)
        {
            var newEntity = new DataSourceRelation
            {
                UseChildEntity = model.UseChildEntity,
                RecursiveRelationDataSourceRelationId = model.RecursiveRelationDataSourceRelationId,
                EntityRelationRelationshipId          = model.EntityRelationRelationshipId,
            };

            context
            .DataSourceRelations
            .Add(newEntity);

            context.SaveChanges();
            var response = new CreateDataSourceRelationModel
            {
                DataSourceRelationId = newEntity.DataSourceRelationId,
                UseChildEntity       = newEntity.UseChildEntity,
                RecursiveRelationDataSourceRelationId = newEntity.RecursiveRelationDataSourceRelationId,
                EntityRelationRelationshipId          = newEntity.EntityRelationRelationshipId,
            };

            return(new ResponseWrapper <CreateDataSourceRelationModel>(_validationDictionary, response));
        }