public static async Task SaveWeatherData(Weather weather)
        {
            if (weather != null && weather.IsValid())
            {
                await weatherDB.InsertOrReplaceAsync(weather);

                await WriteOperations.UpdateWithChildrenAsync(weatherDB, weather);
            }

            if (await weatherDB.Table <Weather>().CountAsync() > CACHE_LIMIT)
            {
                CleanupWeatherData();
            }
        }
Beispiel #2
0
        public async Task <int> SeveAsync(Debt debt)
        {
            int status = 0;

            if (debt.Id != 0)
            {
                status = await _databaseConnection.Database.UpdateAsync(debt);
            }
            else
            {
                status = await _databaseConnection.Database.InsertAsync(debt);
            }
            if (status >= 0)
            {
                await WriteOperations.UpdateWithChildrenAsync(_databaseConnection.Database, debt);
                await UpdateDebtsAsync();
            }
            return(status);
        }