Пример #1
0
        public override async Task <DefaultResponse> UpdateFligthStatus(ControlTowerRequestModel request, ServerCallContext context)
        {
            var response = new DefaultResponse();

            try
            {
                if (!STATUSACCEPT.Where(x => x == request.Status).Any())
                {
                    response.Message = $"Status {request.Status} is not vaild";
                    return(response);
                }

                _airlineRepository.UpdateFligthStatus(request.FligthId, request.Status);

                var statusString = request.Status switch
                {
                    1 => "CURRENTLY-FLYING",
                    2 => "CANCELED",
                    _ => "SCHEDULED"
                };

                response.Message = $"Fligth status changed to {statusString}";
                return(response);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"ERROR: Update fligth status");
            }
            return(response);
        }
Пример #2
0
        public override async Task <DefaultResponse> UpdateFligthStatus(ControlTowerRequestModel request, ServerCallContext context)
        {
            var response = new DefaultResponse();

            try
            {
                var result = await _airlineProxy.UpdateFligthStatus(request.FligthId, request.Status);

                response.Message = result;
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"ERROR: Update fligth status");
            }

            return(response);
        }