/// <summary> /// Save MoistMeter object to the database /// </summary> /// <param name="item"></param> /// <returns></returns> public Task <int> SaveItemAsync(MoistMeter item) { if (item.ID != 0) { return(Database.UpdateAsync(item)); } else { return(Database.InsertAsync(item)); } }
public async Task <int> SaveEntryToDatabase(MQTTMessage latestMessage) { if (latestMessage == null) { return(0); } MoistMeter compressedMoistMeter = new MoistMeter { Topic = Topic, Data = Convert.ToDouble(latestMessage.Message), DateTime = DateTime.Now }; return(await App.MoistMeterDatabase.SaveItemAsync(compressedMoistMeter)); }
/// <summary> /// Delete MoistMeter item from database /// </summary> /// <param name="item"></param> /// <returns>Boolean based on success</returns> public Task <int> DeleteItemAsync(MoistMeter item) { return(Database.DeleteAsync(item)); }