public TableEntity Post([FromBody] TableEntity tableEntity) { tableService .CreateTable(tableEntity); return(tableEntity); }
public async Task <IActionResult> Create([Bind("Seats")] Table table) { if (ModelState.IsValid) { await tableService.CreateTable(table); } return(RedirectToAction(nameof(Index))); }
public IActionResult CreateTable(string id) { tableService.CreateTable(id); SqlMapper.CacheManager.Flush("sys.table"); SqlMapper.CacheManager.Flush("sys.field"); return(Ok(null)); }
/// <summary> /// Initializes a database table. /// </summary> /// <typeparam name="TEntity"> /// Specifies the type of the entities of the table. /// </typeparam> /// <typeparam name="TPrimaryKey"> /// Specifies the type of the primary key of the entities. /// </typeparam> /// <param name="primaryKey"> /// An IKeyInfo object that represents the primary key of the entities. /// </param> /// <param name="identitySpecification"> /// An IdentitySpecification to set an identity field. /// </param> /// <returns> /// The table. /// </returns> public Table <TEntity, TPrimaryKey> Create <TEntity, TPrimaryKey>( IKeyInfo <TEntity, TPrimaryKey> primaryKey, IdentitySpecification <TEntity> identitySpecification, object tableInfo = null) where TEntity : class { if (primaryKey == null) { throw new ArgumentNullException("primaryKey"); } ITableService service = this.database .DatabaseEngine .ServiceProvider .GetService <ITableService>(); if (service == null) { throw new NMemoryException(ExceptionMessages.ServiceNotFound, "TableService"); } Table <TEntity, TPrimaryKey> table = service.CreateTable <TEntity, TPrimaryKey>( primaryKey, identitySpecification, this.database, tableInfo); if (table == null) { throw new NMemoryException(ExceptionMessages.TableNotCreated); } this.RegisterTable(table); return(table); }