feat: added editing cards feature
This commit is contained in:
@@ -33,6 +33,20 @@ class DbHelper(val context: Context, val factory: SQLiteDatabase.CursorFactory?)
|
||||
db.close()
|
||||
}
|
||||
|
||||
fun editCard(id: Int, name: String, codeValue: String, codeType: BarcodeFormat) {
|
||||
val values = ContentValues()
|
||||
|
||||
values.put("name", name)
|
||||
values.put("codeValue", codeValue)
|
||||
values.put("codeType", codeType.name)
|
||||
|
||||
val db = this.writableDatabase
|
||||
|
||||
db.update("cards", values, "id = ?", arrayOf(id.toString()))
|
||||
|
||||
db.close()
|
||||
}
|
||||
|
||||
fun getCards(): List<CardInfo> {
|
||||
val db = this.readableDatabase
|
||||
|
||||
|
||||
Reference in New Issue
Block a user