/// <summary> /// Save a position to the database /// </summary> /// <param name="position">position snapshot information</param> public static void CreatePosition(VatsimClientPilotSnapshot position) { using (var db = new VatsimDbContext()) { // make sure we have a position to write if (position != null) { db.Add(position); db.SaveChanges(); Log.Information($"Added Position: {position} to DB"); } } }
public VatsimClientPilotSnapshot GetVatsimClientPilotSnapshotFromRecord() { VatsimClientPilotSnapshot position = new VatsimClientPilotSnapshot(); 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); }