コード例 #1
0
 public IPostResponse SaveHost([FromContent]DeviceHostList Host)
 {
     //TODO: Add checks for valid hosts.
     if (db.SaveHost(Host))
         return new PostResponse(PostResponse.ResponseStatus.Created, null, new ResponseData { Status = "Host added." });
     return new PostResponse(PostResponse.ResponseStatus.Conflict, null, new ResponseData { Status = "Host failed to add." });
 }
コード例 #2
0
ファイル: SqliteDB.cs プロジェクト: marcusfollrud/LoanToolIoT
 public bool SaveHost(DeviceHostList Host)
 {
     if (Host.ID > 0)
     {
         //We're updating
         var ret = conn.Update(Host);
         if (ret > 0)
         {
             return(true);
         }
         return(false);
     }
     else
     {
         var ret = conn.Insert(Host);
         if (ret > 0)
         {
             return(true);
         }
         return(false);
     }
 }