public FlightViewModel ConvertAirportLogToFlightViewModel(AirportLog log)
        {
            var _flightVM = new FlightViewModel
            {
                ID            = log.ID,
                FlightName    = log.FlightName,
                Location      = log.Location,
                ArrivalDate   = log.ArrivalDate,
                DepartureDate = log.DepartureDate,
                Arriving      = log.Arriving
            };

            return(_flightVM);
        }
Ejemplo n.º 2
0
        public void CreateNewPlaneInDB(string flightName, DateTime arrivalTime)
        {
            using (var entities = new AirportEntities())
            {
                var firstLocation = Locations.InAir;

                var plane = new AirportLog()
                {
                    FlightName    = flightName,
                    Location      = (int)firstLocation,
                    ArrivalDate   = arrivalTime,
                    DepartureDate = null
                };

                entities.AirportLogs.Add(plane);
                entities.SaveChanges();
            }
        }