コード例 #1
0
        public ActionResult PutFlightPlan(long flightId, [FromBody] AmsFlightPlan flightPlan)
        {
            AmsFlightPlan ams_flight_plan = ams_report.AmsFlightPlan.Where(p => p.FlightId == flightId).FirstOrDefault();

            ams_flight_plan.DepartureLocation      = flightPlan.DepartureLocation;
            ams_flight_plan.Waypoints              = flightPlan.Waypoints;
            ams_flight_plan.EstimatedTimeOfArrival = flightPlan.EstimatedTimeOfArrival;
            ams_flight_plan.DestinationLocation    = flightPlan.DestinationLocation;
            ams_flight_plan.AlternateAirports      = flightPlan.AlternateAirports;
            ams_flight_plan.AircraftInformation    = flightPlan.AircraftInformation;
            ams_flight_plan.PilotsInformation      = flightPlan.PilotsInformation;
            ams_flight_plan.Status = flightPlan.Status;

            ams_report.SaveChanges();
            return(Ok("Updated"));
        }
コード例 #2
0
        public IActionResult PostFlightPlan([FromBody] AmsFlightPlan flightPlan)
        {
            AmsFlightPlan ams_flight_plan = new AmsFlightPlan();

            ams_flight_plan.FlightId               = flightPlan.FlightId;
            ams_flight_plan.DepartureLocation      = flightPlan.DepartureLocation;
            ams_flight_plan.Waypoints              = flightPlan.Waypoints;
            ams_flight_plan.EstimatedTimeOfArrival = flightPlan.EstimatedTimeOfArrival;
            ams_flight_plan.DestinationLocation    = flightPlan.DestinationLocation;
            ams_flight_plan.AlternateAirports      = flightPlan.AlternateAirports;
            ams_flight_plan.AircraftInformation    = flightPlan.AircraftInformation;
            ams_flight_plan.PilotsInformation      = flightPlan.PilotsInformation;
            ams_flight_plan.Status = false;
            ams_report.AmsFlightPlan.Add(ams_flight_plan);
            ams_report.SaveChanges();
            //ams_report.AmsFlightPlan.Add(flightPlan);
            //ams_report.SaveChanges();

            return(Ok("Flight plan updated"));
        }