public async Task <ActionResult> Get() { var command = new CommandSelectTables(); await _dbCon.ExecuteAsync(command); if (command.IsSuccessful && command.Data.Length > 0) { Response.StatusCode = StatusCodes.Status200OK; return(Content(command.Data, "application/json")); } return(NoContent()); }
public async Task <ActionResult> Publish(string name) { var command = new CommandPublishTable(name); await _dbCon.ExecuteAsync(command); if (command.IsSuccessful) { return(Created($"api/Table/{name}Publish", command.Data)); } return(NotFound(command.Error)); }
public async Task <ActionResult> Get( string name, [FromQuery(Name = "$page")] int page, [FromQuery(Name = "$size")] int size, [FromQuery(Name = "$select")] string select, [FromQuery(Name = "$order")] string order, [FromQuery(Name = "$filter")] string filter) { var command = new CommandCustomSqlQuery(name, select, order, filter, page, size); await _dbCon.ExecuteAsync(command); if (!command.IsSuccessful) { return(NotFound()); } Response.StatusCode = StatusCodes.Status200OK; return(Content(command.Data, "application/json")); }
public async Task <int> InsertAsync(T entity) { SqlProvider.FormatInsert(entity); return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction)); }
public async Task <int> DeleteAsync() { SqlProvider.FormatDelete(); return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction)); }
public async Task <int> UpdateAsync(Expression <Func <T, T> > updateExpression) { SqlProvider.FormatUpdate(updateExpression); return(await DbCon.ExecuteAsync(SqlProvider.SqlString, SqlProvider.Params, DbTransaction)); }