public async Task BroadcastAcceptedCommand(CMD_ACK ack) { NestContainer db = new NestContainer(); { switch (ack.CommandType) { case "CMD_NAV_Target": CMD_NAV_Target target = await db.CMD_NAV_Target.FindAsync(ack.CommandId); if (target != null && ack.Accepted == true) { target.Acked = true; Clients.All.targetCommandAccepted(target); db.Entry(target).State = EntityState.Modified; await db.SaveChangesAsync(); } break; case "CMD_NAV_Hold": CMD_NAV_Hold hold = await db.CMD_NAV_Hold.FindAsync(ack.CommandId); if (hold != null && ack.Accepted == true) { hold.Acked = true; Clients.All.targetCommandAccepted(hold); db.Entry(hold).State = EntityState.Modified; await db.SaveChangesAsync(); } break; case "CMD_NAV_Return": CMD_NAV_Return goBack = await db.CMD_NAV_Return.FindAsync(ack.CommandId); if (goBack != null && ack.Accepted == true) { goBack.Acked = true; Clients.All.targetCommandAccepted(goBack); db.Entry(goBack).State = EntityState.Modified; await db.SaveChangesAsync(); } break; case "CMD_NAV_Land": CMD_NAV_Land land = await db.CMD_NAV_Land.FindAsync(ack.CommandId); if (land != null && ack.Accepted == true) { land.Acked = true; Clients.All.targetCommandAccepted(land); db.Entry(land).State = EntityState.Modified; await db.SaveChangesAsync(); } break; default: break; } } }
public async void AckCommand(CMD_ACK ack, string connectionId) { Clients.Client(connectionId).Acknowledgement(ack); await BroadcastAcceptedCommand(ack); }