Example #1
0
 public void buildDTO(FlightState fs)
 {
     if (fs != null)
     {
         this.Id           = fs.Id;
         this.Timestamp    = fs.Timestamp;
         this.Latitude     = fs.Latitude;
         this.Longitude    = fs.Longitude;
         this.Altitude     = fs.Altitude;
         this.VelocityX    = fs.VelocityX;
         this.VelocityY    = fs.VelocityY;
         this.VelocityZ    = fs.VelocityZ;
         this.Yaw          = fs.Yaw;
         this.Roll         = fs.Roll;
         this.Pitch        = fs.Pitch;
         this.YawRate      = fs.YawRate;
         this.RollRate     = fs.RollRate;
         this.PitchRate    = fs.PitchRate;
         this.BatteryLevel = fs.BatteryLevel;
     }
 }
        public async Task<IHttpActionResult> PostFlightState(FlightState flightState)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.FlightStates.Add(flightState);
            await db.SaveChangesAsync();

            return Ok(flightState);
        }