示例#1
0
        public dynamic CreateEndPointCollectionProperty([FromBody] CreateEndPointCollectionPropertyInputModel model)
        {
            var orchestrator = new EndPointCollectionPropertyOrchestrator(new ModelStateWrapper(this.ModelState));

            return(orchestrator.CreateEndPointCollectionProperty(model).GetResponse());
        }
        public ResponseWrapper <CreateEndPointCollectionPropertyModel> CreateEndPointCollectionProperty(CreateEndPointCollectionPropertyInputModel model)
        {
            var newEntity = new EndPointCollectionProperty
            {
                PropertiesEndPointPropertyId = model.PropertiesEndPointPropertyId,
                EndPointPropertyId           = model.EndPointPropertyId,
                EndPointProperty             =
                    new EndPointProperty
                {
                    Name = model.EndPointProperty.Name,
                    EndPointPropertyType = model.EndPointProperty.EndPointPropertyType,
                    EntityId             = model.EndPointProperty.EntityId,
                    DataSourceId         = model.EndPointProperty.DataSourceId,
                },
            };

            context
            .EndPointCollectionProperties
            .Add(newEntity);

            context.SaveChanges();
            var response = new CreateEndPointCollectionPropertyModel
            {
                EndPointCollectionPropertyId = newEntity.EndPointCollectionPropertyId,
                PropertiesEndPointPropertyId = newEntity.PropertiesEndPointPropertyId,
                EndPointPropertyId           = newEntity.EndPointPropertyId,
            };

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