public bool addAirportinDatabase(AirportDetails airportDetails) { _cache.Remove(cacheKey); if (airportDetails.Continent.ToUpper().Equals(euContient)) { _airportRepository.AddAsync(airportDetails); return(true); } else { return(false); } }
public async Task <AirportResponseObject> CreateAsync(Airport airport) { try { await _airportRepository.AddAsync(airport); await _unitOfWork.CompleteAsync(); return(new AirportResponseObject(airport)); } catch (Exception e) { return(new AirportResponseObject($"The following error occured when creating the airport: {e.Message}")); } }
public async Task <AddResult> AddAsync(Airport airport) { AirportEntity airportDal = _mapper.Map <AirportEntity>(airport); bool duplicate = await _airportRepository.CheckDuplicateAsync(airportDal); if (duplicate) { return(new AddResult(ResultTypes.Duplicate, null)); } int addedAirportId = await _airportRepository.AddAsync(airportDal); return(new AddResult(ResultTypes.Ok, addedAirportId)); }