public async Task EditAirport(AirPortBE airport, CancellationToken token) { var existingAirport = await _flightplanner_entities.Airport.Where(x => x.Id == airport.Id).FirstOrDefaultAsync(); if (existingAirport != null) { AirPortMap.Map(airport, existingAirport); await Save(token); } }
public async Task AddAirport(AirPortBE airport, CancellationToken token) { _flightplanner_entities.Airport.Add(AirPortMap.Map(airport)); await Save(token); }
public async Task <AirPortBE> GetAirportById(int idAirport) { var airport = await _flightplanner_entities.Airport.Where(x => x.Id == idAirport).FirstOrDefaultAsync(); return(AirPortMap.Map(airport)); }
public async Task <AirPortBE> GetAirportByCode(string codeAirport) { var airport = await _flightplanner_entities.Airport.Where(x => x.Code == codeAirport).FirstOrDefaultAsync(); return(AirPortMap.Map(airport)); }
public async Task <List <AirPortBE> > GetAirports() { var airports = await _flightplanner_entities.Airport.ToListAsync(); return(AirPortMap.Map(airports)); }