示例#1
0
 public bool addAirportinDatabase(AirportDetails airportDetails)
 {
     _cache.Remove(cacheKey);
     if (airportDetails.Continent.ToUpper().Equals(euContient))
     {
         _airportRepository.AddAsync(airportDetails);
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#2
0
        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}"));
            }
        }
示例#3
0
        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));
        }