public void DeleteBook(string id) { var sqlUpdate = $"delete from {_tableName} where {_columnName_ID} = @id"; var parameters = new[] { new SQLiteParameter("@id", id) }; DBSQLiteCommand.ExecuteNonQueryCommand(sqlUpdate, parameters); }
public void UpdateBook(string ID, string Title, string Description, string Abstract, string ISBN, string Author, string Publisher) { var sqlUpdate = $"update {_tableName} set {_columnName_Title} = @title, {_columnName_Description} = @desc, {_columnName_Abstract} = @abs, {_columnName_ISBN} = @isbn, {_columnName_Author} = @auth, {_columnName_Publisher} = @pub where {_columnName_ID} = @id"; var parameters = new[] { new SQLiteParameter("@title", Title), new SQLiteParameter("@desc", Description), new SQLiteParameter("@abs", Abstract), new SQLiteParameter("@isbn", ISBN), new SQLiteParameter("@auth", Author), new SQLiteParameter("@pub", Publisher), new SQLiteParameter("@id", ID) }; DBSQLiteCommand.ExecuteNonQueryCommand(sqlUpdate, parameters); }
public void CreateBook(string Title, string Description, string Abstract, string ISBN, string Author, string Publisher) { var sqlInsert = $"insert into {_tableName} values(@id, @title, @description, @abstract, @isbn, @author, @publisher, @creationDate)"; var parameters = new[] { new SQLiteParameter("@id", Guid.NewGuid().ToString()), new SQLiteParameter("@title", Title), new SQLiteParameter("@description", Description), new SQLiteParameter("@abstract", Abstract), new SQLiteParameter("@isbn", ISBN), new SQLiteParameter("@author", Author), new SQLiteParameter("@publisher", Publisher), new SQLiteParameter("@creationDate", Common.Now) }; DBSQLiteCommand.ExecuteNonQueryCommand(sqlInsert, parameters); }