public async Task CreateDatabase() { SQLiteConnection.CreateFile("Countries.sqlite"); var createCountries = "create table 'Countries' (" + "'Id' integer not null primary key unique, " + "'Name' text unique, " + "'CountryCode' text unique, " + "'Population' integer, " + "'LatestCases' integer, " + "'LatestDeaths' integer, " + "'Cases' integer, " + "'Deaths' integer, " + "'LastUpdated' text)"; await SQLiteDatabaseManager.NonQuery(createCountries, ConnectionString); }
public async Task DeleteAll() { var deleteCountries = "delete from Countries"; await SQLiteDatabaseManager.NonQuery(deleteCountries, ConnectionString); }
public async Task Delete(DetailedCountryModel country) { var sqlCommand = $"delete from Countries where Id = {country.Id}"; await SQLiteDatabaseManager.NonQuery(sqlCommand, ConnectionString); }
public async Task DeleteCountryTimeline(int countryId, string tableName) { var sqlCommand = $"delete from {tableName} where countryId = {countryId}"; await SQLiteDatabaseManager.NonQuery(sqlCommand, ConnectionString); }
public async Task Update(DetailedCountryModel country) { var sqlCommand = $"update Countries set LatestCases = {country.LatestCases}, LatestDeaths = {country.LatestDeaths}, Cases = {country.Cases}, Deaths = {country.Deaths}, LastUpdated = '{country.LastUpdated:s}' where Name = '{country.Name}'"; await SQLiteDatabaseManager.NonQuery(sqlCommand, ConnectionString); }
public async Task Create(DetailedCountryModel country) { var sqlCommand = $"insert into Countries (Id, Name, CountryCode, Population, LatestCases, LatestDeaths, Cases, Deaths, LastUpdated) values ({country.Id}, '{country.Name}', '{country.CountryCode}', {country.Population}, {country.LatestCases}, {country.LatestDeaths}, {country.Cases}, {country.Deaths}, '{country.LastUpdated:s}')"; await SQLiteDatabaseManager.NonQuery(sqlCommand, ConnectionString); }