internal static void UploadFlightPlan(Models.FlightPlan plan)
        {
            using (var entities = new FlightCompanionEntities())
            {
                entities.FlightPlans.Add(new FlightPlan
                {
                    Departure   = plan.DepartureIcao,
                    Destination = plan.DestinationIcao,
                    Distance    = plan.Distance,
                    Waypoints   = plan.Waypoints
                });

                entities.SaveChanges();
            }
        }
        internal static bool UploadChart(int chartType, HttpPostedFileBase[] files)
        {
            var chartTypes = DataConnector.GetChartTypes();

            foreach (var file in files)
            {
                var bytes      = new byte[file.InputStream.Length];
                var postedFile = file.InputStream.Read(bytes, 0, bytes.Length);

                using (var entities = new FlightCompanionEntities())
                {
                    entities.Charts.Add(new Chart
                    {
                        ChartType = chartType,
                        Name      = Path.GetFileName(file.FileName),
                        ChartData = bytes
                    });

                    entities.SaveChanges();
                }
            }

            return(true);
        }