/// <summary> /// Save a position to the database /// </summary> /// <param name="position">position snapshot information</param> public static async void CreatePositionAsync(VatsimClientPilotSnapshotV1 position) { using (var db = new VatsimDbContext()) { // make sure we have a position to write if (position != null) { await db.AddAsync(position); await db.SaveChangesAsync(); Log.Information($"Added Position: {position} to DB"); } } }
public VatsimClientPilotSnapshotV1 GetVatsimClientPilotSnapshotFromRecord() { VatsimClientPilotSnapshotV1 position = new VatsimClientPilotSnapshotV1(); position.Altitude = this.Altitude; position.Callsign = this.Callsign; position.Cid = this.Cid; position.Clienttype = this.Clienttype; position.Groundspeed = this.Groundspeed; position.Heading = this.Heading; position.Latitude = this.Latitude; position.Longitude = this.Longitude; position.Protrevision = this.Protrevision; position.QNH_iHg = this.QNH_iHg; position.QNH_Mb = this.QNH_Mb; position.Realname = this.Realname; position.Server = this.Server; position.TimeLastAtisReceived = this.TimeLastAtisReceived; position.TimeLogon = this.TimeLogon; position.TimeStamp = DateTime.Now; position.Transponder = this.Transponder; return(position); }