コード例 #1
0
ファイル: VehicleHub.cs プロジェクト: dragosguta/NEST-App
 /**
  * Returns -1 if the insertion into the database failed.
  */
 public int SendCommand(CMD_NAV_Target target)
 {
     using (var db = new NestContainer())
     {
         target = db.CMD_NAV_Target.Add(target);
         int result = db.SaveChanges();
         if (result == 1)
         {
             //The target was added, so send the target command to the vehicles.
             Clients.Group("vehicles").sendTargetCommand(target, Context.ConnectionId);
             //Return the target ID so they know what the ID is in the database.
             return target.Id;
         }
         else
         {
             //Not added, return, let caller know
             return -1;
         }
     }
 }