コード例 #1
0
 /// <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));
     }
 }
コード例 #2
0
        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));
        }
コード例 #3
0
 /// <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));
 }