Example #1
0
        public ResponseWrapper <CreateEntityModel> CreateEntity(CreateEntityInputModel model)
        {
            var newEntity = new Entity
            {
                Name       = model.Name,
                PluralName = model.PluralName,
                SchemaId   = model.SchemaId,
            };

            context
            .Entities
            .Add(newEntity);

            context.SaveChanges();
            var response = new CreateEntityModel
            {
                EntityId   = newEntity.EntityId,
                Name       = newEntity.Name,
                PluralName = newEntity.PluralName,
                SchemaId   = newEntity.SchemaId,
            };

            return(new ResponseWrapper <CreateEntityModel>(_validationDictionary, response));
        }
        public dynamic CreateEntity([FromBody] CreateEntityInputModel model)
        {
            var orchestrator = new EntityOrchestrator(new ModelStateWrapper(this.ModelState));

            return(orchestrator.CreateEntity(model).GetResponse());
        }