Ejemplo n.º 1
0
        private async Task <int> DeleteInventory(IEnumerable <int> inventoryIds)
        {
            int result;

            using (var connection = new SQLiteConnection(SqlHelpers.ConnectionString))
            {
                connection.Open();
                using (var cmd = connection.CreateCommand())
                {
                    cmd.CommandText = $"DELETE FROM [Inventory] WHERE Id IN ({SqlHelpers.GenerateParamStringFromList(inventoryIds)})";
                    cmd.Parameters.AddRange(SqlHelpers.GenerateSQLParamFromList(inventoryIds).ToArray());
                    result = await cmd.ExecuteNonQueryAsync();
                }
            }

            return(result);
        }