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")); }
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")); }