Esempio n. 1
0
        public override async Task <AircraftRequestModel> GetAircraft(AircraftsFilter request, ServerCallContext context)
        {
            var response = new AircraftRequestModel();

            try
            {
                var aircrafts = await _aircraftRepository.GetAirCraft(request.LicensePlate);

                if (aircrafts == null)
                {
                    response.Message = $"Aircraft {request.LicensePlate} does not exist";
                    _logger.LogInformation($"Get Aircraft {request.LicensePlate} does not exist");
                    return(response);
                }
                response.LicensePlate = aircrafts.LicensePlate;
                response.Model        = aircrafts.Model;
                response.Passengers   = aircrafts.Passengers;

                _logger.LogInformation($"Get {aircrafts.LicensePlate} Aircraft");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"ERROR: Get {request.LicensePlate} Aircraft");
            }
            return(response);
        }