public async Task <int> CreateStock(Models.Stock stock) { var query = new InsertQuery(Tables.StockTable, Tables.StockFields.Where(x => !x.Equals("ID")).ToList(), stock.GetFieldValues()); var command = new SqlCommand(query.ToString(), _connection); return(await command.ExecuteNonQueryAsync()); }
public async Task <int> Create <T>(T element, string tableName, List <string> fields) { var query = new InsertQuery(tableName, fields.Where(x => !x.Equals("ID")).ToList(), ((IBaseModel)element).GetFieldValues()); var command = new SqlCommand(query.ToString(), _connection); return(await command.ExecuteNonQueryAsync()); }