public ActionResult FlightDetailsUpdate(FlightPlanDetails flight)
        {
            if (ModelState.IsValid)
            {
                AllDbContext    context = new AllDbContext();
                PlanesDbContext db      = new PlanesDbContext();

                ViewBag.PlaneID = new SelectList(db.Planes.Where(n => n.isAllotted == false), "PlaneID", "PlaneID");


                var items = context.Planes.Where(n => n.isAllotted == false);
                ViewBag.PlaneId = items;
                if (items != null)
                {
                    ViewBag.data = items;
                }
                var pilot = db.Planes.Where(n => n.PlaneID == flight.PlaneID);
                foreach (var i in pilot)
                {
                    i.isAllotted = true;
                }
                flight.isActive = true;
                flight.PilotID  = User.Identity.GetUserName();
                context.Flights.Add(flight);
                db.SaveChanges();
                context.SaveChanges();
                TempData["savedFlight"] = "Flight Details Added to Database Sucessfull!";
                return(RedirectToAction("Index", "Pilot"));
            }
            return(View());
        }
        public ActionResult UpdateFlightPlan(FlightPlanDetails flightPlan)
        {
            PlanesDbContext db  = new PlanesDbContext();
            var             db1 = new FlightDbContext();

            ViewBag.PlaneID = new SelectList(db.Planes.Where(n => n.isAllotted == false), "PlaneID", "PlaneID");
            var flight = db1.Flights.FirstOrDefault(n => n.PlaneID == flightPlan.PlaneID);

            db1.SaveChanges();


            return(View());
        }