示例#1
0
        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());
        }
示例#2
0
        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());
        }