Ejemplo n.º 1
0
        public async Task PostPilotAsync(Models.Pilot pilot)
        {
            if (pilot == null)
            {
                throw new ArgumentNullException();
            }

            _paraContext.Pilots.Add(pilot);
            await _paraContext.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public void Save(Models.Pilot pilot)
        {
            MySqlConnection conection = adapter.GetConection();

            string sql = "INSERT INTO `flujoaereo`.`pilot` (`Name`, `Sex`, `Status`, `AirlineID`) VALUES ('" + pilot.Name + "', '" + pilot.Sex + "', '" + pilot.PilotStatus + "', '" + pilot.AirlineID + "');";

            MySqlCommand insertCommnad = new MySqlCommand(sql)
            {
                Connection = conection
            };

            insertCommnad.ExecuteNonQuery();
            insertCommnad.Connection.Close();
        }
        public static PilotDto MapPilotDto(this Models.Pilot pilot)
        {
            // BLACK BOX
            var pilotDto = new PilotDto
            {
                PilotId             = pilot.ID,
                FirstName           = pilot.FirstName,
                LastName            = pilot.LastName,
                Address             = pilot.Address,
                PhoneNumber         = pilot.PhoneNumber,
                Weight              = pilot.Weight,
                Role                = pilot.Role,
                IsActive            = pilot.IsActive,
                NumberOfFlights     = pilot.Flights.Count,
                Flights             = pilot.Flights,
                Possessions         = pilot.Possessions,
                TraineeshipPayments = pilot.TraineeshipPayments,
                PilotTraineeships   = pilot.PilotTraineeships
            };

            return(pilotDto);
        }
Ejemplo n.º 4
0
 public async Task UpdatePilotAsync(Models.Pilot pilot)
 {
     _paraContext.Entry(pilot).State = EntityState.Modified;
     await _paraContext.SaveChangesAsync();
 }