public async Task DeleteCounterAsync(Counter counter) { var connection = new SQLiteAsyncConnection(_dbPath); await connection.DeleteAsync(counter); OnCountersChanged(); }
public async Task AddOrUpdateCounterAsync(Counter counter) { var connection = new SQLiteAsyncConnection(_dbPath); if (counter.Id == 0) await connection.InsertAsync(counter); else await connection.InsertOrReplaceAsync(counter); OnCountersChanged(); }
public async Task IncrementCounterAsync(Counter counter) { var connection = new SQLiteAsyncConnection(_dbPath); counter.Value++; await AddOrUpdateCounterAsync(counter); var history = new CounterIncrementHistory { CounterId = counter.Id, IncrementDateTimeUtc = DateTime.UtcNow }; await connection.InsertAsync(history); }